public static int GetReligionCastId(string ReligionName, string CastName) { int religionId = 0; int CastId = 0; int ReligionCastId = 0; ReligionBAL religionBAL = new ReligionBAL(); IQueryable <Entities.Religion> religionEntities = religionBAL.FindBy(r => r.ReligionName.ToLower() == ReligionName.ToLower()); if (religionEntities != null && religionEntities.Count() > 0) { religionId = religionEntities.FirstOrDefault().ReligionId; } CastBAL CastBAL = new CastBAL(); IQueryable <Entities.Cast> CastEntities = CastBAL.FindBy(r => r.CastName.ToLower() == CastName.ToLower()); if (CastEntities != null && CastEntities.Count() > 0) { CastId = CastEntities.FirstOrDefault().CastId; } ReligionCastBAL ReligionCastBAL = new ReligionCastBAL(); IQueryable <Entities.ReligionCast> ReligionCastEntities = ReligionCastBAL.FindBy(r => r.ReligionId == religionId && r.CastId == CastId); if (ReligionCastEntities != null && ReligionCastEntities.Count() > 0) { ReligionCastId = ReligionCastEntities.FirstOrDefault().ReligionCastId; } return(ReligionCastId); }
// // GET: /SysAdmin/Religion/Details/5 public ActionResult Details(int id) { ReligionVM viewModel = new ReligionVM(); ReligionBAL balObject = new ReligionBAL(); IQueryable <Entities.Religion> entites = balObject.FindBy(a => a.ReligionId == id); if (entites != null && entites.Count() > 0) { Entities.Religion entity = entites.FirstOrDefault(); viewModel.ReligionId = entity.ReligionId; viewModel.ReligionName = entity.ReligionName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; } return(View(viewModel)); }
// // GET: /SysAdmin/ReligionCast/Details/5 public ActionResult Details(int id) { ReligionCastVM viewModel = new ReligionCastVM(); ReligionCastBAL balObject = new ReligionCastBAL(); IQueryable <Entities.ReligionCast> entites = balObject.FindBy(a => a.ReligionCastId == id); if (entites != null && entites.Count() > 0) { Entities.ReligionCast entity = entites.FirstOrDefault(); viewModel.ReligionCastId = entity.ReligionCastId; viewModel.ReligionId = entity.ReligionId; viewModel.CastId = entity.CastId; ReligionBAL ReligionBAL = new ReligionBAL(); CastBAL CastBAL = new CastBAL(); viewModel.ReligionName = ReligionBAL.FindBy(c => c.ReligionId == entity.ReligionId).FirstOrDefault().ReligionName; viewModel.CastName = CastBAL.FindBy(c => c.CastId == entity.CastId).FirstOrDefault().CastName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; } return(View(viewModel)); }