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);
            }
        }
示例#3
0
 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);
     }
 }
示例#4
0
 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);
     }
 }
示例#5
0
 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");
 }