private CityMasterListVM GetCityListVM(CityMasterFilter objFilter) { //Thread.Sleep(1000); //CountryMasterListVM userListVM = null; CommonBL objCommonBL = null; try { objCityBL = new CityBL(); objListVM = new CityMasterListVM(); objCommonBL = new CommonBL(); objFilter.PagingRoute = new PagingRoute() { Action = "Index", Controller = "State" }; objListVM.lstCityMaster = objCityBL.GetData(objFilter); // objListVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 }); objListVM.QueryBO = objListVM.objFilter = objFilter; return(objListVM); } catch (Exception ex) { throw; } finally { objListVM = null; } }
public ActionResult Action(CityMasterFilter objFilter, string submit) { CommonBL objCommonBL = null; CityMaster objCity = null; try { objDetailsVM = new CityDetailsVM(); if (submit.ToLower() == "edit") { objCommonBL = new CommonBL(); TempData["CountryFilter"] = objFilter; objCityBL = new CityBL(); objDetailsVM = new CityDetailsVM(); objDetailsVM.CityMstr = objCityBL.GetData(new CityMasterFilter() { CityID = objFilter.StateID }).FirstOrDefault(); objDetailsVM.CntMst = Chikitsa.DataAccessLayer.StateDAL.GetCountry(); // objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 }); return(View("Details", objDetailsVM)); } else if (submit.ToLower() == "delete") { objCityBL = new CityBL(); objListVM = new CityMasterListVM(); objCity = new CityMaster(objFilter.StateID); objCity.ModifiedBy = 1; objCity.Remark = "Deleted"; objResponse = objCityBL.SaveState(objCity, "D"); objFilter.CountryID = 0; objListVM = GetCityListVM(objFilter); objListVM.Toast = WebCommon.SetToast(objResponse); return(View("Index", objListVM)); } } catch (Exception ex) { throw; } finally { objCityBL = null; objDetailsVM = null; objListVM = null; objCommonBL = null; } return(null); }