public ActionResult Create(PlayerViewModel data) { var player = data.AsPlayer(); ValidatePlayerInfo(player); if (!ModelState.IsValid) return View(data); _session.Add(player); _session.Commit(); return RedirectToAction("Index"); }
public ActionResult Update(PlayerViewModel data) { var player = data.AsPlayer(); ValidatePlayerInfo(player); if (!ModelState.IsValid) return View(data); var original = _session.SingleById<Player>(data.Id); original.UpdateFrom(player); return RedirectToAction("Index"); }