Beispiel #1
0
 public ActionResult ManageSector(ManageSectorModel TSMSectorModel)
 {
     try
     {
         bool exist = false;
         if (TSMSectorModel.ID == Guid.Empty)
         {
             exist = TSMSectorModel.CheckSector();
         }
         if (exist == false)
         {
             TSMSector tsmSector = TSMSectorModel.Save();
             if (TSMSectorModel.ID != Guid.Empty)
             {
                 TempData["Success"] = "true";
                 return(Redirect(Url.Action("manage-sector", "Admin") + "?id=" + tsmSector.ID));
             }
             else
             {
                 TempData["Success"] = "true";
                 return(Redirect(Url.Action("manage-sector", "Admin") + "?id=" + tsmSector.ID));
             }
         }
         else
         {
             TempData["Exist"]   = "true";
             TempData["Success"] = "false";
         }
     }
     catch (Exception ex)
     {
         TempData["Success"] = "false";
         ErrorLog.WriteLog("SectorController", "ManageSector", ex, "");
     }
     return(View("~/Views/Admin/Sector/manage-sector.cshtml", TSMSectorModel));
 }