// GET: MapInfos/Create public ActionResult Create() { var vm = new MapInfoCreateEditViewModel(); vm.MapSelectList = new SelectList(_uow.Maps.All, nameof(Map.MapId), nameof(Map.MapName)); vm.MatchSelectList = new SelectList(_uow.Matches.All, nameof(Match.MatchId), nameof(Match.FullName)); return(View(vm)); }
public ActionResult Edit(MapInfoCreateEditViewModel vm) { if (ModelState.IsValid) { _uow.MapInfos.Update(vm.MapInfo); _uow.Commit(); return(RedirectToAction("Index")); } vm.MapSelectList = new SelectList(_uow.Maps.All, nameof(Map.MapId), nameof(Map.MapName), vm.MapInfo.MapId); vm.MatchSelectList = new SelectList(_uow.Matches.All, nameof(Match.MatchId), nameof(Match.MatchId), vm.MapInfo.MatchId); return(View(vm)); }
// GET: MapInfos/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MapInfo mapInfo = _uow.MapInfos.GetById(id); if (mapInfo == null) { return(HttpNotFound()); } var vm = new MapInfoCreateEditViewModel() { MapInfo = mapInfo }; vm.MapSelectList = new SelectList(_uow.Maps.All, nameof(Map.MapId), nameof(Map.MapName), vm.MapInfo.MapId); vm.MatchSelectList = new SelectList(_uow.Matches.All, nameof(Match.MatchId), nameof(Match.MatchId), vm.MapInfo.MatchId); return(View(vm)); }