Example #1
0
 public ActionResult UpdateHoliday(SystemViewModels.AdmHelgdagViewModel holiday)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var userName  = User.Identity.GetUserName();
             var holidayDb = ConvertViewModelToAdmHelgdag(holiday);
             _portalAdminService.UppdateraHelgdag(holidayDb, userName);
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
             ErrorManager.WriteToErrorLog("SystemController", "UpdateHoliday", e.ToString(), e.HResult,
                                          User.Identity.Name);
             var errorModel = new CustomErrorPageModel
             {
                 Information  = "Ett fel inträffade vid uppdatering av helgdagsinformation.",
                 ContactEmail = ConfigurationManager.AppSettings["ContactEmail"],
             };
             return(View("CustomError", errorModel));
         }
     }
     return(RedirectToAction("GetHolidays"));
 }