示例#1
0
 public ActionResult Edit(int serviceId)
 {
     try
     {
         BusinessAccessLayer.BALService.BALService bALServices = new BusinessAccessLayer.BALService.BALService();
         ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
         var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
         BusinessObjects.Models.Service service = bALServices.selectServiceById(serviceId, bankId);
         if (service == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Services"));
         }
         else if (service.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Services"));
         }
         else
         {
             service.minimumServiceTime = service.minimumServiceTime != 0 ? service.minimumServiceTime : 45;
             service.maximumServiceTime = service.maximumServiceTime != 0 ? service.maximumServiceTime : 300;
             return(View(service));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }
 public ActionResult Edit(int serviceId)
 {
     try
     {
         BusinessAccessLayer.BALService.BALService bALServices = new BusinessAccessLayer.BALService.BALService();
         BusinessObjects.Models.Service            service     = bALServices.selectServiceById(serviceId, ((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         if (service == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Services"));
         }
         else if (service.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Services"));
         }
         else
         {
             return(View(service));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }