public ActionResult StateListGridView() { statesMasterService = new StateServiceClient(); EntityDtos <StateDto> stateDto = statesMasterService.FindAll(); ViewData["StateList"] = stateDto.Entities; return(PartialView("StateListGridView", ViewData["StateList"])); }
public ActionResult AddState(AddStateModel addState) { ViewData["Error"] = null; TempData["Success"] = null; try { statesMasterService = new StateServiceClient(); countryClient = new CountryMasterServiceClient(); if (ModelState.IsValid) { UserDto currentUserDto = (UserDto)Session[Constants.SKCURRENTUSER]; StateDto statesMasterDto = new StateDto(); statesMasterDto.StateInCountry = countryClient.GetById(1); statesMasterDto.RegionType = addState.RegionType; statesMasterDto.RegionName = addState.RegionName; statesMasterDto = statesMasterService.Create(statesMasterDto, currentUserDto.UserName); if (statesMasterDto.Response.HasWarning) { ViewData["Error"] = ErrorAndValidationMessages.BRStateValidation; } else { TempData["StateSaved"] = string.Format(ClientResources.StateSaved, addState.RegionType, addState.RegionName); return(RedirectToAction("StateList", "Masters")); } } } catch (Exception ex) { return(View("ErrorPage")); } finally { if (statesMasterService != null) { statesMasterService.Close(); } if (countryClient != null) { countryClient.Close(); } } return(View(addState)); }
public ActionResult StateList() { try { statesMasterService = new StateServiceClient(); EntityDtos <StateDto> stateDto = statesMasterService.FindAll(); ViewData["StateList"] = stateDto.Entities; } catch (Exception ex) { return(View("ErrorPage")); } finally { if (statesMasterService != null) { statesMasterService.Close(); } } return(View("StateList", ViewData["StateList"])); }