// GET: Admin/MemberProfileUpdate public ActionResult Index() { if (Session["WhiteLevelUserId"] != null) { initpage(); var db = new DBContext(); long mem_id = MemberCurrentUser.MEM_ID; var userinformation = db.TBL_MASTER_MEMBER.Where(x => x.MEM_ID == mem_id).FirstOrDefault(); ManageUserProfileDetails userinfo = new ManageUserProfileDetails() { UName = userinformation.UName, MEM_ID = userinformation.MEM_ID, MEMBER_MOBILE = userinformation.MEMBER_MOBILE, MEMBER_NAME = userinformation.MEMBER_NAME, COMPANY = userinformation.COMPANY, ADDRESS = userinformation.ADDRESS, CITY = userinformation.CITY, PIN = userinformation.PIN, EMAIL_ID = userinformation.EMAIL_ID }; return(View(userinfo)); } else { Session["WhiteLevelUserId"] = null; Session["WhiteLevelUserName"] = null; Session["UserType"] = null; Session.Remove("WhiteLevelUserId"); Session.Remove("WhiteLevelUserName"); Session.Remove("UserType"); return(RedirectToAction("Index", "Login", new { area = "" })); } }
public async Task <ActionResult> Index(ManageUserProfileDetails objval) { initpage();//// var db = new DBContext(); using (System.Data.Entity.DbContextTransaction ContextTransaction = db.Database.BeginTransaction()) { try { long mem_id = MemberCurrentUser.MEM_ID; var changepass = db.TBL_MASTER_MEMBER.Where(x => x.MEM_ID == mem_id).FirstOrDefault(); if (changepass != null) { changepass.UName = objval.UName; changepass.COMPANY = objval.COMPANY; changepass.MEMBER_MOBILE = objval.MEMBER_MOBILE; changepass.MEMBER_NAME = objval.MEMBER_NAME; changepass.ADDRESS = objval.ADDRESS; changepass.CITY = objval.CITY; changepass.PIN = objval.PIN; db.Entry(changepass).State = System.Data.Entity.EntityState.Modified; await db.SaveChangesAsync(); } //throw new Exception(); ContextTransaction.Commit(); ViewBag.Message = "Profile Updated Successfully..."; return(View()); } catch (Exception ex) { ContextTransaction.Rollback(); Logger.Error("Controller:- MemberChangePassword(Admin), method:- ChangePassword (POST) Line No:- 271", ex); return(RedirectToAction("Exception", "ErrorHandler", new { area = "" })); throw ex; //return View("Error", new HandleErrorInfo(ex, "APILabel", "CreateMember")); } } //return View(); }