public ActionResult EditUserDetails(tbl_User_Profiless model) { string exception = ""; try { if (!string.IsNullOrEmpty(model.EmailAddress)) { int mobdt = _user.GetAll().Where(x => x.EmailAddress == model.EmailAddress && x.pkid != model.pkid).Count(); if (mobdt > 0) { exception = "User Email Already Taken."; return(RedirectToAction("AdminUserRegister", "Account", new { Exceptionmsg = exception })); } } if (!string.IsNullOrEmpty(model.MobileNumber)) { int mobdt = _user.GetAll().Where(x => x.MobileNumber == model.MobileNumber && x.pkid != model.pkid).Count(); if (mobdt > 0) { exception = "User Mobile Number Already Taken."; return(RedirectToAction("AdminUserRegister", "Account", new { Exceptionmsg = exception })); } } tbl_User_Profile abc = _user.Get(model.pkid); abc.FirstName = model.FirstName; abc.UserName = model.UserName; abc.MobileNumber = model.MobileNumber; abc.AddressLine1 = model.AddressLine1; abc.RoleName = model.RoleName; abc.AddressLine1 = model.AddressLine1; abc.AddressLine2 = model.AddressLine2; abc.EmailAddress = model.EmailAddress; abc.LastModifiedDate = DateTime.Now; _user.Update(abc); return(RedirectToAction("AdminUserRegister", "Account")); } catch (Exception e) { Commonfunction.LogError(e, Server.MapPath("~/Log.txt")); ViewBag.Exception = e.Message; return(RedirectToAction("AdminUserRegister", "Account")); } }
public ActionResult SaveCustomer() { string userid = ""; try { userid = TempData["id"].ToString(); string ro = TempData["role"].ToString(); string Uname = null; try { Uname = TempData["username"].ToString(); } catch { } string email = null; try { email = TempData["ema"].ToString(); } catch { } string pas = TempData["passwo"].ToString(); string funame = null; try { funame = TempData["fname"].ToString(); } catch { } string mobino = null; try { mobino = TempData["mobi"].ToString(); } catch { } tbl_User_Profile abc = new tbl_User_Profile(); abc.User_fkid = userid; abc.UserName = Uname; abc.RoleName = ro; abc.EmailAddress = email; abc.FirstName = funame; abc.MobileNumber = mobino; abc.RegisteredDate = DateTime.Now; abc.LastModifiedDate = DateTime.Now; _user.Add(abc); return(RedirectToAction("AdminUserRegister", "Account")); } catch (Exception e) { Commonfunction.LogError(e, Server.MapPath("~/Log.txt")); return(RedirectToAction("AdminUserRegister", "Account", new { Exceptionmsg = e.Message })); } }