public ActionResult UpdateAlliance(AFBAlliance alliance, bool isAdd) { int n = _IAFBAllianceService.UpdateAlliance(alliance, isAdd); return Json(n); }
/// <summary> /// 联盟新增、修改 /// </summary> /// <param name="gameType"></param> /// <param name="allianceid"></param> /// <returns></returns> public ActionResult UpdateAlliance(string gameType, int? allianceid) { List<AFBAlliance> alliances = _IAFBAllianceService.QueryByCondition(p => p.GameType == gameType).OrderBy(p => p.Lever).ToList(); AFBAlliance alliance = new AFBAlliance { GameType = gameType }; if (allianceid != null) { alliance = alliances.SingleOrDefault(p => p.AllianceID == allianceid); } ViewBag.FirstAlliance = alliances.Where(p => p.Lever == 1).Select(p => new SelectListItem { Text = p.AllianceName, Value = p.AllianceID.ToString() }); ViewBag.SecondAlliance = alliances.Where(p => p.Lever == 2).Select(p => new SelectListItem { Text = p.AllianceName, Value = p.AllianceID.ToString() }); ViewBag.IsAdd = allianceid == null; ViewBag.navigation = new Navigation { Level = new List<string> { AppData.GetGameTypeName(gameType), allianceid == null ? "聯盟新增" : "聯盟修改" }, Area = RouteData.DataTokens["area"].ToString(), Controller = RouteData.Values["controller"].ToString(), Action = "AFBAlliance", HaveButton = true, ButtonText = "回聯盟管理", Parameter = new List<Parameter>{ new Parameter("gameType", gameType) } }; return View(alliance); }