public ActionResult Select() { string mode = Request.QueryString["Grid-mode"]; if (!string.IsNullOrEmpty(mode)) { return(this.RedirectToAction("Create")); } else { List <ReligionVM> viewModels = new List <ReligionVM>(); ReligionBAL balObject = new ReligionBAL(); IQueryable <Entities.Religion> entites = balObject.GetAll(); foreach (Entities.Religion entity in entites) { ReligionVM viewModel = new ReligionVM(); viewModel.ReligionId = entity.ReligionId; viewModel.ReligionName = entity.ReligionName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(this.View("Index", new GridModel <ReligionVM> { Data = viewModels })); } }
/// <summary> /// method for get religions list /// </summary> /// <returns>religions list</returns> public JsonResult GetReligionsList() { ReligionBAL religionBAL = new ReligionBAL(); var religionsList = from obj in religionBAL.GetAll().Where(c => c.Status == true) select new SelectListItem() { Text = obj.ReligionName, Value = obj.ReligionId.ToString() }; return(this.Json(religionsList, JsonRequestBehavior.AllowGet)); }
// // GET: /SysAdmin/ReligionCast/Create public ActionResult Create() { ReligionCastVM viewModel = new ReligionCastVM(); ReligionBAL ReligionBAL = new ReligionBAL(); viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem() { Text = obj.ReligionName, Value = obj.ReligionId.ToString() }; viewModel.Status = true; return(View(viewModel)); }
public ActionResult Index() { List <ReligionVM> viewModels = new List <ReligionVM>(); ReligionBAL balObject = new ReligionBAL(); IQueryable <Entities.Religion> entites = balObject.GetAll(); foreach (Entities.Religion entity in entites) { ReligionVM viewModel = new ReligionVM(); viewModel.ReligionId = entity.ReligionId; viewModel.ReligionName = entity.ReligionName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <ReligionVM> { Data = viewModels })); }
public ActionResult Create(ReligionCastVM viewModel) { try { // TODO: Add insert logic here if (ModelState.IsValid) { Entities.ReligionCast entity = new Entities.ReligionCast(); entity.ReligionCastId = viewModel.ReligionCastId; entity.ReligionId = viewModel.ReligionId; entity.CastId = viewModel.CastId; entity.ReserveCategory = viewModel.ReserveCategory; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; ReligionCastBAL balObject = new ReligionCastBAL(); balObject.Add(entity); //this.TempData["AlertMessage"] = "Successfully Save !!!"; return(RedirectToAction("Index")); } else { ReligionBAL ReligionBAL = new ReligionBAL(); viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem() { Text = obj.ReligionName, Value = obj.ReligionId.ToString() }; return(View(viewModel)); } } catch { ReligionBAL ReligionBAL = new ReligionBAL(); viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem() { Text = obj.ReligionName, Value = obj.ReligionId.ToString() }; return(View(viewModel)); } }
public ActionResult Edit(ReligionCastVM viewModel) { try { // TODO: Add update logic here if (ModelState.IsValid) { Entities.ReligionCast entity = new Entities.ReligionCast(); entity.ReligionCastId = viewModel.ReligionCastId; entity.ReligionId = viewModel.ReligionId; entity.CastId = viewModel.CastId; entity.ReserveCategory = viewModel.ReserveCategory; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; ReligionCastBAL balObject = new ReligionCastBAL(); balObject.Edit(entity); return(RedirectToAction("Index")); } else { ReligionBAL ReligionBAL = new ReligionBAL(); viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem() { Text = obj.ReligionName, Value = obj.ReligionId.ToString() }; return(View(viewModel)); } } catch { ReligionBAL ReligionBAL = new ReligionBAL(); viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem() { Text = obj.ReligionName, Value = obj.ReligionId.ToString() }; return(View()); } }