Пример #1
0
 public ActionResult Edit(JockeyViewModel model)
 {
     try
     {
         _jokeyService.EditJockey(model);
         return RedirectToAction("Index");
     }
     catch
     {
         return View(model);
     }
 }
Пример #2
0
        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;
     }
 }
Пример #6
0
 public ActionResult DeleteJockey(JockeyViewModel model)
 {
     _jokeyService.DeleteJockey(model.JockeyId);
     return RedirectToAction("Index");
 }