public ActionResult Index(int?id) { try { if (id == null) { id = (int)TempData["daID"]; } DestinationViewModel destViewModel = new DestinationViewModel(); destViewModel.GetDestinationDetails((int)id); destViewModel.GetScreenAccessRights("Destination Details"); CommonFunctions comfuns = new CommonFunctions(); var da = comfuns.FindDA((int)id); destViewModel.DAID = (int)id; destViewModel.DAName = da.DAName; destViewModel.ModuleId = da.ModuleId; TempData["daId"] = destViewModel.DAID; return(View(destViewModel)); } catch (Exception ex) { errorlogviewmodel = new ErrorLogViewModel(); errorlogviewmodel.LogError(ex); return(View("Error")); } }
public ActionResult Index(DestinationViewModel destViewModel) { try { if (ModelState.IsValid) { destViewModel.destDesc = destViewModel.destDesc.Trim(); destViewModel.AddDestination(destViewModel); TempData["daID"] = destViewModel.DAID; return(RedirectToAction("Index", "Destination")); } destViewModel.GetDestinationDetails(destViewModel.DAID); return(View(destViewModel)); } catch (Exception ex) { errorlogviewmodel = new ErrorLogViewModel(); errorlogviewmodel.LogError(ex); return(View("Error")); } }