예제 #1
0
 public async Task <IActionResult> AddVaccination(Vaccination vaccination)
 {
     if (!ModelState.IsValid)
     {
         return(View(vaccination));
     }
     try
     {
         vaccination.Date     = DateTime.Now.Date;
         vaccination.IsActive = true;
         await _servicesService.AddVaccination(vaccination);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", ex.Message);
         return(View(vaccination));
     }
     return(RedirectToAction(nameof(Vaccinations)));
 }