public ActionResult Edit(JockeyViewModel model) { try { _jokeyService.EditJockey(model); return RedirectToAction("Index"); } catch { return View(model); } }
public ActionResult Create(JockeyViewModel model) { try { _jokeyService.AddNewJockey(model); return RedirectToAction("Index"); } catch { return View(model); } }
public void EditJockey(JockeyViewModel model) { using (var unit = new UnitOfWork()) { var jockey = unit.Jockey.Get(model.JockeyId); jockey.Alias = model.Alias; jockey.DateBirth = DateTime.Parse(model.DateBirth); jockey.FirstName = model.FirstName; jockey.LastName = model.LastName; jockey.MiddleName = model.LastName; unit.Jockey.Save(jockey); } }
public void AddNewJockey(JockeyViewModel model) { using (var unit = new UnitOfWork()) { var jockey = new Jockey { Alias = model.Alias, DateBirth = DateTime.Parse(model.DateBirth), FirstName = model.FirstName, LastName = model.LastName, MiddleName = model.MiddleName }; unit.Jockey.Save(jockey); } }
public JockeyViewModel GetJockeyDetails(int id) { using (var unit = new UnitOfWork()) { var jockey = unit.Jockey.Get(id); var model = new JockeyViewModel { JockeyId = jockey.Id, Alias = jockey.Alias, DateBirth = _generalService.GetDateTimeStringForDatepicker(jockey.DateBirth), FirstName = jockey.FirstName, LastName = jockey.LastName, MiddleName = jockey.MiddleName }; return model; } }
public ActionResult DeleteJockey(JockeyViewModel model) { _jokeyService.DeleteJockey(model.JockeyId); return RedirectToAction("Index"); }