예제 #1
0
 public IActionResult Create(HolidayViewModel newHoliday)
 {
     if (ModelState.IsValid)
     {
         var holidayToCreate = new Holiday()
         {
             FromDate    = newHoliday.FromDate,
             ToDate      = newHoliday.ToDate,
             HolidayName = newHoliday.HolidayName,
             Comments    = newHoliday.Comments,
             HolidayId   = Guid.NewGuid()
         };
         _employee.AddNewHoliday(holidayToCreate);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View("Form", newHoliday));
     }
 }