当前位置: 首页>>代码示例>>C#>>正文


C# ZkDataContext.SubmitAndMergeChanges方法代码示例

本文整理汇总了C#中ZkData.ZkDataContext.SubmitAndMergeChanges方法的典型用法代码示例。如果您正苦于以下问题:C# ZkDataContext.SubmitAndMergeChanges方法的具体用法?C# ZkDataContext.SubmitAndMergeChanges怎么用?C# ZkDataContext.SubmitAndMergeChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZkData.ZkDataContext的用法示例。


在下文中一共展示了ZkDataContext.SubmitAndMergeChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateTechs

        public static void GenerateTechs()
        {
            var db = new ZkDataContext();
            db.StructureTypes.DeleteAllOnSubmit(db.StructureTypes.Where(x => x.Unlock != null));
            db.SubmitAndMergeChanges();

            foreach (var u in db.Unlocks.Where(x => x.UnlockType == UnlockTypes.Unit))
            {
                var s = new StructureType()
                {
                    BattleDeletesThis = false,
                    Cost = u.XpCost / 2,
                    MapIcon = "techlab.png",
                    DisabledMapIcon = "techlab_dead.png",
                    Name = u.Name,
                    Description = string.Format("Access to {0} and increases influence gains", u.Name),
                    TurnsToActivate = u.XpCost / 100,
                    IsBuildable = true,
                    IsIngameDestructible = true,
                    IsBomberDestructible = true,
                    Unlock = u,
                    UpkeepEnergy = u.XpCost / 5,
                    IngameUnitName = "pw_" + u.Code,
                };
                db.StructureTypes.InsertOnSubmit(s);
            }
            db.SubmitAndMergeChanges();

        }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:29,代码来源:PlanetwarsFixer.cs

示例2: AddContribution

        public ActionResult AddContribution(int accountID,int kudos, string item, string currency, double gross, double grossEur, double netEur, string email, string comment, bool isSpring, DateTime date) {
            using (var db = new ZkDataContext()) {
                var acc = db.Accounts.Find(accountID);
                var contrib = new Contribution()
                              {
                                  AccountID = accountID,
                                  ManuallyAddedAccountID = Global.AccountID,
                                  KudosValue = kudos,
                                  ItemName = item,
                                  IsSpringContribution = isSpring,
                                  Comment = comment,
                                  OriginalCurrency = currency,
                                  OriginalAmount = gross,
                                  Euros = grossEur,
                                  EurosNet = netEur,
                                  Time = date,
                                  Name = acc.Name,
                                  Email = email
                              };
                db.Contributions.InsertOnSubmit(contrib);
                db.SubmitAndMergeChanges();
                acc.Kudos = acc.KudosGained - acc.KudosSpent;
                db.SubmitAndMergeChanges();
            }


            return RedirectToAction("Index");
        }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:28,代码来源:ContributionsController.cs

示例3: Redeem

        public ActionResult Redeem(string code) {
            var db = new ZkDataContext();
            if (string.IsNullOrEmpty(code)) return Content("Code is empty");
            var contrib = db.Contributions.SingleOrDefault(x => x.RedeemCode == code);
            if (contrib == null) return Content("No contribution with that code found");
            if (contrib.AccountByAccountID != null) return Content(string.Format("This contribution has been assigned to {0}, thank you.", contrib.AccountByAccountID.Name));
            var acc = db.Accounts.Find(Global.AccountID);
            contrib.AccountByAccountID = acc;
            db.SubmitAndMergeChanges();
            acc.Kudos = acc.KudosGained - acc.KudosSpent;
            db.SubmitAndMergeChanges();

            return Content(string.Format("Thank you!! {0} Kudos have been added to your account {1}", contrib.KudosValue, contrib.AccountByAccountID.Name));
        }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:14,代码来源:ContributionsController.cs

示例4: NwSteamHandler

        public NwSteamHandler(TasClient tas, string webApiKey)
        {
            steamApi = new SteamWebApi(GlobalConst.SteamAppID, webApiKey);
            tas.Said += (sender, args) =>
            {
                if (args.Place == SayPlace.User && args.UserName != tas.UserName && args.Text.StartsWith("!linksteam"))
                {
                    var token = args.Text.Substring(11);
                    User user;
                    if (tas.ExistingUsers.TryGetValue(args.UserName, out user))
                    {

                        Utils.StartAsync(() =>
                        {
                            Thread.Sleep(2000); // steam is slow to get the ticket from client .. wont verify if its checked too soon
                            var steamID = steamApi.WebValidateAuthToken(token);
                            var info = steamApi.WebGetPlayerInfo(steamID);

                            using (var db = new ZkDataContext())
                            {
                                var acc = db.Accounts.Find(user.AccountID);
                                acc.SteamID = steamID;
                                acc.SteamName = info.personaname;
                                db.SubmitAndMergeChanges();
                                tas.Extensions.PublishAccountData(acc);
                            }
                        });
                    }


                }

            };
        }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:34,代码来源:NwSteamHandler.cs

示例5: RemoveBlockedCompany

 public ActionResult RemoveBlockedCompany(int companyID)
 {
     ZkDataContext db = new ZkDataContext();
     BlockedCompany todel = db.BlockedCompanies.First(x => x.CompanyID == companyID);
     string name = todel.CompanyName;
     db.BlockedCompanies.DeleteOnSubmit(todel);
     db.SubmitAndMergeChanges();
     var str = string.Format("{0} removed blocked VPN company: {1}", Global.Account.Name, name);
     Global.Server.GhostChanSay(GlobalConst.ModeratorChannel, str);
     return RedirectToAction("BlockedVPNs");
 }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:11,代码来源:LobbyController.cs

示例6: PerformLeaveFaction

        public static Faction PerformLeaveFaction(int accountID, bool keepClan = false, ZkDataContext db = null)
        {
            if (db == null) db = new ZkDataContext();
            Account acc = db.Accounts.Single(x => x.AccountID == Global.AccountID);
            Faction faction = acc.Faction;

            if (!keepClan && acc.Clan != null) ClansController.PerformLeaveClan(Global.AccountID);
            db.AccountRoles.DeleteAllOnSubmit(acc.AccountRolesByAccountID.Where(x => !keepClan || x.ClanID == null));
            acc.ResetQuotas();

            foreach (var ps in acc.PlanetStructures)
            {
                ps.OwnerAccountID = null;
            }

            foreach (var planet in acc.Planets)
            {
                planet.OwnerAccountID = null;
            }

            // delete channel subscription
            if (true)   //(!acc.IsZeroKAdmin)
            {
                var channelSub = db.LobbyChannelSubscriptions.FirstOrDefault(x => x.AccountID == acc.AccountID && x.Channel == acc.Faction.Name);
                if (channelSub != null) db.LobbyChannelSubscriptions.DeleteOnSubmit(channelSub);
            }

            db.Events.InsertOnSubmit(Global.CreateEvent("{0} leaves faction {1}", acc, acc.Faction));
            db.SubmitChanges();
            PlanetwarsController.SetPlanetOwners(db);


            using (var db2 = new ZkDataContext())
            {
                Account acc2 = db2.Accounts.Single(x => x.AccountID == Global.AccountID);
                acc2.FactionID = null;
                db2.SubmitAndMergeChanges();

                PlanetwarsController.SetPlanetOwners(db2);
            }
            return faction;
        }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:42,代码来源:FactionsController.cs

示例7: ImportIpnPayment

 public void ImportIpnPayment(NameValueCollection values, byte[] rawRequest) {
     try {
         var parsed = ParseIpn(values);
         var contribution = AddPayPalContribution(parsed);
         var verified = VerifyRequest(rawRequest);
         if (contribution != null && !verified) {
             Error(
                 string.Format(
                     "Warning, transaction {0} by {1} VERIFICATION FAILED, check that it is not a fake! {2}/Contributions ",
                     parsed.TransactionID,
                     parsed.Name,
                     GlobalConst.BaseSiteUrl));
             using (var db = new ZkDataContext()) {
                 db.Contributions.First(x => x.ContributionID == contribution.ContributionID).Comment = "VERIFICATION FAILED";
                 db.SubmitAndMergeChanges();
             }
         }
     } catch (Exception ex) {
         Trace.TraceError(ex.ToString());
         Error(ex.ToString());
     }
 }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:22,代码来源:PayPalInterface.cs

示例8: PerformLeaveFaction

        public static Faction PerformLeaveFaction(int accountID, bool keepClan = false, ZkDataContext db = null)
        {
            if (db == null) db = new ZkDataContext();
            Account acc = db.Accounts.Single(x => x.AccountID == Global.AccountID);
            Faction faction = acc.Faction;

            if (!keepClan && acc.Clan != null) ClansController.PerformLeaveClan(Global.AccountID);
            db.AccountRoles.DeleteAllOnSubmit(acc.AccountRolesByAccountID.Where(x => !keepClan || x.ClanID == null).ToList());
            acc.ResetQuotas();

            foreach (var ps in acc.PlanetStructures)
            {
                ps.OwnerAccountID = null;
            }

            foreach (var planet in acc.Planets)
            {
                planet.OwnerAccountID = null;
            }


            db.Events.InsertOnSubmit(Global.CreateEvent("{0} leaves faction {1}", acc, acc.Faction));
            db.SubmitChanges();
            PlanetwarsController.SetPlanetOwners(db);


            using (var db2 = new ZkDataContext())
            {
                Account acc2 = db2.Accounts.Single(x => x.AccountID == Global.AccountID);
                acc2.FactionID = null;
                db2.SubmitAndMergeChanges();

                PlanetwarsController.SetPlanetOwners(db2);
            }
            return faction;
        }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:36,代码来源:FactionsController.cs

示例9: ModifyTreaty

        /// <summary>
        /// Create or modify a PlanetWars <see cref="FactionTreaty"/>
        /// </summary>
        /// <param name="factionTreatyID">Existing <see cref="FactionTreaty"/> ID, if modifying one</param>
        /// <param name="turns">How long the treaty lasts</param>
        /// <param name="acceptingFactionID"></param>
        /// <param name="effectTypeID"><see cref="TreatyEffect"/> to add or remove, if applicable</param>
        /// <param name="effectValue"></param>
        /// <param name="planetID">Specifies the <see cref="Planet"/> for planet-based effects</param>
        /// <param name="isReverse"></param>
        /// <param name="note">Diplomatic note readable by both parties, to better communicate their intentions</param>
        /// <param name="add">If not null or empty, add the specified <see cref="TreatyEffect"/></param>
        /// <param name="delete">Delete the specified <see cref="TreatyEffect"/>?</param>
        /// <param name="propose">If not null or empty, this is a newly proposed treaty</param>
        /// <returns></returns>
        public ActionResult ModifyTreaty(int factionTreatyID,
                                         int? turns,
                                         int? acceptingFactionID,
                                         int? effectTypeID,
                                         double? effectValue,
                                         int? planetID,
                                         bool? isReverse,
                                         string note,
                                         string add,int? delete,string propose) {
            if (!Global.Account.HasFactionRight(x => x.RightDiplomacy)) return Content("Not a diplomat!");

            FactionTreaty treaty;

            // submit, store treaty in db 
            var db = new ZkDataContext();

            if (factionTreatyID > 0) {
                treaty = db.FactionTreaties.Single(x => x.FactionTreatyID == factionTreatyID);
                if (treaty.TreatyState != TreatyState.Invalid) return Content("Treaty already in progress!");
            }
            else {
                treaty = new FactionTreaty();
                db.FactionTreaties.InsertOnSubmit(treaty);
                treaty.FactionByAcceptingFactionID = db.Factions.Single(x => x.FactionID == acceptingFactionID);
            }
            treaty.AccountByProposingAccountID = db.Accounts.Find(Global.AccountID);
            treaty.FactionByProposingFactionID = db.Factions.Single(x => x.FactionID == Global.FactionID);
            treaty.TurnsRemaining = turns;
            treaty.TurnsTotal = turns;
            treaty.TreatyNote = note;
            

            if (!string.IsNullOrEmpty(add)) {
                TreatyEffectType effectType = db.TreatyEffectTypes.Single(x => x.EffectTypeID == effectTypeID);
                var effect = new TreatyEffect
                             {
                                 FactionByGivingFactionID = isReverse == true ? treaty.FactionByAcceptingFactionID : treaty.FactionByProposingFactionID,
                                 FactionByReceivingFactionID = 
                                     isReverse == true ? treaty.FactionByProposingFactionID : treaty.FactionByAcceptingFactionID,
                                 TreatyEffectType = effectType,
                                 FactionTreaty = treaty
                             };
                if (effectType.HasValue) {
                    if (effectType.MinValue.HasValue && effectValue < effectType.MinValue.Value) effectValue = effectType.MinValue;
                    if (effectType.MaxValue.HasValue && effectValue > effectType.MaxValue.Value) effectValue = effectType.MaxValue;
                }
                if (effectType.HasValue) effect.Value = effectValue;
                if (effectType.IsPlanetBased) effect.PlanetID = planetID.Value;
                db.TreatyEffects.InsertOnSubmit(effect);
            }
            if (delete != null) {
                db.TreatyEffects.DeleteOnSubmit(db.TreatyEffects.Single(x=>x.TreatyEffectID == delete));
            }
            db.SubmitAndMergeChanges();

            if (!string.IsNullOrEmpty(propose)) {
                treaty.TreatyState = TreatyState.Proposed;
                
                db.Events.InsertOnSubmit(Global.CreateEvent("{0} proposes a new treaty between {1} and {2} - {3}",treaty.AccountByProposingAccountID, treaty.FactionByProposingFactionID, treaty.FactionByAcceptingFactionID, treaty));

                db.SubmitAndMergeChanges();
                return RedirectToAction("Detail", new { id = treaty.ProposingFactionID});
            }

            return View("FactionTreatyDefinition", treaty);
        }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:81,代码来源:FactionsController.cs

示例10: SubmitCreate

        public ActionResult SubmitCreate(Clan clan, HttpPostedFileBase image, HttpPostedFileBase bgimage, bool noFaction = false)
        {
            //using (var scope = new TransactionScope())
            //{
            ZkDataContext db = new ZkDataContext();
            bool created = clan.ClanID == 0; // existing clan vs creation

            //return Content(noFaction ? "true":"false");
            if (noFaction) clan.FactionID = null;

            var new_faction = db.Factions.SingleOrDefault(x => x.FactionID == clan.FactionID);
            if ((new_faction != null) && new_faction.IsDeleted) return Content("Cannot create clans in deleted factions");

            Clan orgClan = null;

            if (!created)
            {
                if (!Global.Account.HasClanRight(x => x.RightEditTexts) || clan.ClanID != Global.Account.ClanID) return Content("Unauthorized");
                orgClan = db.Clans.Single(x => x.ClanID == clan.ClanID);
                orgClan.ClanName = clan.ClanName;
                orgClan.Shortcut = clan.Shortcut;
                orgClan.Description = clan.Description;
                orgClan.SecretTopic = clan.SecretTopic;
                orgClan.Password = clan.Password;
            }
            else
            {
                if (Global.Clan != null) return Content("You already have a clan");
                // should just change their faction for them?
                if (Global.FactionID != 0 && Global.FactionID != clan.FactionID) return Content("Clan must belong to same faction you are in");
            }
            if (string.IsNullOrEmpty(clan.ClanName) || string.IsNullOrEmpty(clan.Shortcut)) return Content("Name and shortcut cannot be empty!");
            if (!ZkData.Clan.IsShortcutValid(clan.Shortcut)) return Content("Shortcut must have at least 1 characters and contain only numbers and letters");

            // check if our name or shortcut conflicts with existing clans
            // if so, allow us to create a new clan over it if it's a deleted clan, else block action
            var existingClans = db.Clans.Where(x => ((SqlFunctions.PatIndex(clan.Shortcut,x.Shortcut) > 0 || SqlFunctions.PatIndex(clan.ClanName, x.ClanName) > 0) && x.ClanID != clan.ClanID));
            if (existingClans.Count() > 0)
            {
                if (existingClans.Any(x => !x.IsDeleted)) return Content("Clan with this shortcut or name already exists");
                if (created)
                {
                    Clan deadClan = existingClans.First();
                    clan = deadClan;
                    if (noFaction) clan.FactionID = null;
                }
            }
            else if (created) db.Clans.InsertOnSubmit(clan);

            if (created && (image == null || image.ContentLength == 0)) return Content("A clan image is required");
            if (image != null && image.ContentLength > 0)
            {
                var im = Image.FromStream(image.InputStream);
                if (im.Width != 64 || im.Height != 64) im = im.GetResized(64, 64);
                db.SubmitChanges(); // needed to get clan id for image url - stupid way really
                im.Save(Server.MapPath(clan.GetImageUrl()));
            }
            if (bgimage != null && bgimage.ContentLength > 0)
            {
                var im = Image.FromStream(bgimage.InputStream);
                db.SubmitChanges(); // needed to get clan id for image url - stupid way really
                // DW - Actually its not stupid, its required to enforce locking.
                // It would be possbile to enforce a pre-save id
                im.Save(Server.MapPath(clan.GetBGImageUrl()));
            }
            db.SubmitChanges();

            if (created) // we created a new clan, set self as founder and rights
            {
                var acc = db.Accounts.Single(x => x.AccountID == Global.AccountID);
                acc.ClanID = clan.ClanID;

                var leader = db.RoleTypes.FirstOrDefault(x => x.RightKickPeople && x.IsClanOnly);
                if (leader != null)
                    db.AccountRoles.InsertOnSubmit(new AccountRole()
                    {
                        AccountID = acc.AccountID,
                        Clan = clan,
                        RoleType = leader,
                        Inauguration = DateTime.UtcNow
                    });

                db.Events.InsertOnSubmit(Global.CreateEvent("New clan {0} formed by {1}", clan, acc));
            }
            else
            {
                if (clan.FactionID != orgClan.FactionID)   // set factions of members
                {
                    var originalID = orgClan.FactionID;
                    orgClan.FactionID = clan.FactionID;     // <- not possible to change faction // now it is!
                    if (orgClan.Faction != null && orgClan.Faction.IsDeleted)
                    {
                        orgClan.FactionID = originalID;
                        throw new ApplicationException("You cannot join deleted faction");
                    }
                    db.Events.InsertOnSubmit(Global.CreateEvent("Clan {0} moved to faction {1}", clan, orgClan.Faction));

                    db.SubmitAndMergeChanges();

                    foreach (Account member in orgClan.Accounts)
//.........这里部分代码省略.........
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:101,代码来源:ClansController.cs

示例11: SaveStateToDb

        void SaveStateToDb()
        {
            var db = new ZkDataContext();
            Galaxy gal = db.Galaxies.First(x => x.IsDefault);

            gal.MatchMakerState = JsonConvert.SerializeObject((MatchMakerState)this);

            gal.AttackerSideCounter = AttackerSideCounter;
            gal.AttackerSideChangeTime = AttackerSideChangeTime;
            db.SubmitAndMergeChanges();
        }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:11,代码来源:PlanetWarsMatchMaker.cs

示例12: RecalculateKudos

 public static void RecalculateKudos()
 {
     var db = new ZkDataContext();
     foreach (var acc in db.Accounts.Where(x => x.KudosPurchases.Any() || x.ContributionsByAccountID.Any())) acc.Kudos = acc.KudosGained - acc.KudosSpent;
     db.SubmitAndMergeChanges();
 }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:6,代码来源:Program.cs

示例13: RemovePunishment

        public ActionResult RemovePunishment(int punishmentID) {
            var db = new ZkDataContext();
            var todel = db.Punishments.First(x => x.PunishmentID == punishmentID);
            db.Punishments.DeleteOnSubmit(todel);
            db.SubmitAndMergeChanges();

            Account acc = todel.AccountByAccountID;
            string punisherName = "<unknown>";
            if (todel.CreatedAccountID != null)
            {
                Account adminAcc = db.Accounts.Find((int)todel.CreatedAccountID);
                punisherName = adminAcc.Name;
            }
            Global.Nightwatch.Tas.Say(SayPlace.Channel, AuthService.ModeratorChannel, string.Format("{0} removed a punishment given by {1} ", Global.Account.Name, punisherName), true);
            Global.Nightwatch.Tas.Say(SayPlace.Channel, AuthService.ModeratorChannel, string.Format("to {0} for: {1} ", acc.Name, todel.Reason), true);

            return RedirectToAction("Detail", "Users", new { id = todel.AccountID });
        }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:18,代码来源:UsersController.cs

示例14: AutoClosePolls

        public static void AutoClosePolls()
        {
            var db = new ZkDataContext();
            foreach (var p in db.Polls.Where(x => x.IsHeadline && x.ExpireBy != null && x.ExpireBy < DateTime.UtcNow && x.RoleTypeID != null).ToList())
            {
                var yes = p.PollVotes.Count(x => x.PollOption.OptionText == "Yes");
                var no = p.PollVotes.Count(x => x.PollOption.OptionText == "No");
                var acc = p.AccountByRoleTargetAccountID;
                if (yes > no)
                {
                    if (p.RoleIsRemoval)
                    {
                        var toDelete = db.AccountRoles.Where(x => x.AccountID == acc.AccountID && x.RoleTypeID == p.RoleTypeID);
                        db.AccountRoles.DeleteAllOnSubmit(toDelete);
                        db.Events.InsertOnSubmit(Global.CreateEvent("{0} was removed from the {1} role of {2} by a vote - {3} for, {4} against", acc, (object)p.Clan ?? p.Faction, p.RoleType, yes, no));

                        db.SubmitAndMergeChanges();

                        AuthServiceClient.SendLobbyMessage(acc, string.Format("You were recalled from the function of {0} by a vote", p.RoleType.Name));
                    }
                    else
                    {
                        if (!acc.AccountRolesByAccountID.Any(x => x.RoleTypeID == p.RoleTypeID))
                        {
                            Account previous = null;
                            if (p.RoleType.IsOnePersonOnly)
                            {
                                var entries = db.AccountRoles.Where(x => x.RoleTypeID == p.RoleTypeID && (p.RoleType.IsClanOnly ? x.ClanID == p.RestrictClanID : x.FactionID == p.RestrictFactionID)).ToList();

                                if (entries.Any())
                                {
                                    previous = entries.First().Account;
                                    db.AccountRoles.DeleteAllOnSubmit(entries);
                                    db.SubmitAndMergeChanges();
                                }
                            }

                            var entry = new AccountRole()
                                        {
                                            Account = acc,
                                            Inauguration = DateTime.UtcNow,
                                            Clan = p.Clan,
                                            Faction = p.Faction,
                                            RoleType = p.RoleType
                                        };
                            acc.AccountRolesByAccountID.Add(entry);
                            if (previous == null)
                                db.Events.InsertOnSubmit(Global.CreateEvent("{0} was elected for the {1} role of {2} by a vote - {3} for, {4} against",
                                                   acc,
                                                   (object)p.Clan ?? p.Faction,
                                                   p.RoleType,
                                                   yes,
                                                   no));

                            else db.Events.InsertOnSubmit(Global.CreateEvent("{0} was elected for the {1} role of {2} by a vote, replacing {3} - {4} for, {5} against",
                                                   acc,
                                                   (object)p.Clan ?? p.Faction,
                                                   p.RoleType,
                                                   previous,
                                                   yes,
                                                   no));

                            AuthServiceClient.SendLobbyMessage(acc, string.Format("Congratulations!! You were elected into a function of {0} by a vote", p.RoleType.Name));
                        }
                    }
                }

                p.IsHeadline = false;
                db.Polls.DeleteOnSubmit(p);
            }
            db.SubmitAndMergeChanges();
        }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:72,代码来源:PollController.cs

示例15: SetTopic

 /// <summary>
 /// Set faction secret topic (applied to lobby channel as well)
 /// </summary>
 public ActionResult SetTopic(int factionID, string secretTopic) {
     var db = new ZkDataContext();
     var fac = db.Factions.Single(x => x.FactionID == factionID);
     if (Global.Account.FactionID == fac.FactionID && Global.Account.HasFactionRight(x=>x.RightEditTexts)) {
         fac.SecretTopic = secretTopic;
         db.SubmitAndMergeChanges();
         Global.Server.SetTopic(fac.Shortcut,secretTopic, Global.Account.Name);
         return RedirectToAction("Detail", new { id = fac.FactionID });
     }
     return Content("Denied");
 }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:14,代码来源:FactionsController.cs


注:本文中的ZkData.ZkDataContext.SubmitAndMergeChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。