public ActionResult Edit(ClanWarUpsertViewModel clanWar) { ActionResult result = View(); try { ClanUser clanUser = HttpContext.GetCurrentLoginInformation(); int clanWarId = ClanWarManager.Upsert(clanWar, clanUser.id); if (clanWarId > 0) { //Insert member picks //vv List<WarRanking> rankings = new List<WarRanking>(); List <ClanWarPickViewModel> picks = new List <ClanWarPickViewModel>(); List <ClanUser> clanMembers = ClanUserManager.SelectAllByClanId(clanWar.ClanId); short i = 1; foreach (ClanUser member in clanMembers) { WarRanking ranking = new WarRanking() { clanUserId = member.id, clanWarId = clanWarId }; //vv rankings.Add(ranking); ClanWarPickViewModel pick = new ClanWarPickViewModel() { ClanUserId = member.id, ClanMemberWarPosition = i, ClanWarId = clanWarId, PickVS = i }; picks.Add(pick); i++; } //vv RankingsManager.Upsert(rankings); ClanWarPicksManager.Upsert(picks); } //TODO //vv an Else here should display a message stating that the war was not inserted (and no exception apparently) result = RedirectToAction("Index"); } catch { result = View(clanWar); } return(result); }
public ActionResult Details(int id, string warNote) { ActionResult result = View(); ClanUser clanUser = HttpContext.GetCurrentLoginInformation(); ClanWarUpsertViewModel clanWarInfo = ClanWarUpsertViewModel.Get(id); //The only updatable field when war started is the war notes. clanWarInfo.WarNote = warNote; ClanWarManager.Upsert(clanWarInfo, clanUser.id); result = RedirectToAction("Index"); return(result); }