public ActionResult ProfilePage(tbl_GroupRoleMappingMaster obj, string hid) { if (Session["User"] == null) { return(RedirectToAction("LogIn", "LogIn")); } try { if (!string.IsNullOrEmpty(hid)) { new MvcHelper((tbl_UserDetail)Session["User"]); tbl_GroupRoleMappingMaster tbl = new tbl_GroupRoleMappingMaster() { IsActive = true, GroupName = obj.GroupName, PageName = obj.PageName, EntryBy = ((tbl_UserDetail)Session["user"]).UserGroup.ToString(), }; MvcHelper.EditGroupRoleMappingMaster(obj, Convert.ToInt32(hid)); } } catch { TempData["Error"] = "Something went wrong."; } ViewBag.groupList = MvcHelper.GetGroupRoleMappingMasterList(); return(View()); }
public static void EditGroupRoleMappingMaster(tbl_GroupRoleMappingMaster obj, double id) { using (BNKModel db = new BNKModel()) { tbl_GroupRoleMappingMaster editobj = db.tbl_GroupRoleMappingMaster.Where(x => x.ID == id).FirstOrDefault(); if (!string.IsNullOrEmpty(obj.ApproveStat) && obj.ApproveStat.Equals(Constants.ModifyStatus)) { editobj.PageName = obj.PageName; editobj.UpdateBy = SessionObj.AccountName; editobj.ApproveStat = Constants.ApproveModifyStatus; editobj.UpdateTime = DateTime.Now; editobj.IsActive = true; db.SaveChanges(); } else { editobj.PageName = obj.PageName; editobj.IsActive = false; editobj.UpdateBy = SessionObj.AccountName; editobj.ApproveStat = Constants.ModifyStatus; editobj.UpdateTime = DateTime.Now; db.SaveChanges(); } } }