Ejemplo n.º 1
0
        public IActionResult Edit(Guid id)
        {
            var model     = UnitOfWork.DeathDateDal.GetById(id);
            var DeathDate = new DeathDateCEViewModel()
            {
                Id   = model.Id,
                Year = model.Year
            };

            return(View(DeathDate));
        }
Ejemplo n.º 2
0
 public IActionResult EditConfirmed(DeathDateCEViewModel model)
 {
     if (ModelState.IsValid)
     {
         var entity = UnitOfWork.DeathDateDal.GetById(model.Id);
         entity.Year = model.Year;
         UnitOfWork.Commit();
         return(RedirectToAction("Index", "DeathDate"));
     }
     return(View());
 }
Ejemplo n.º 3
0
 public IActionResult CreateConfirmed(DeathDateCEViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (UnitOfWork.DeathDateDal.GetQueryable().FirstOrDefault(p => p.Year == model.Year) == null)
         {
             var deathDate = new DeathDate()
             {
                 Id   = Guid.NewGuid(),
                 Year = model.Year
             };
             UnitOfWork.DeathDateDal.Add(deathDate);
             UnitOfWork.Commit();
             return(RedirectToAction("Index", "DeathDate"));
         }
     }
     return(RedirectToAction("Index", "DeathDate"));
 }