public ActionResult ChangePass(Admin_Account md, string OldPassWord) { var convertPass = WebsiteExtension.EncryptPassword(md.PasswordHash); Admin_Account CheckUser = Admin_Account.SingleOrDefault("Where Id=@0 AND UserName=@1 AND PasswordHash=@2 AND Status=1", md.Id, md.UserName, WebsiteExtension.EncryptPassword(OldPassWord)); if (CheckUser != null) { try { CheckUser.PasswordHash = convertPass; CheckUser.UpdatedDate = DateTime.Now; CheckUser.UpdatedStaffId = Convert.ToInt32(Session["UserID"]); CheckUser.Save(); return(Redirect("/Login/Login")); } catch { return(View()); } } return(View()); }
public JsonResult Create_Account(Admin_Account obj) { Admin_Account Acc = new Admin_Account(); try { if (!string.IsNullOrEmpty(obj.PasswordHash)) { Acc.PasswordHash = WebsiteExtension.EncryptPassword(obj.PasswordHash); } Acc.BranchId = Constants.Branch; Acc.UserName = obj.UserName; Acc.FullName = obj.FullName; Acc.TypeId = obj.TypeId; Acc.Mobile = obj.Mobile; Acc.Email = obj.Email; Acc.Address = obj.Address; Acc.CreatedDate = DateTime.Now; Acc.Status = 1; Acc.Active = 1; Acc.Save(); } catch (Exception ex) { return(Json(0)); } return(Json(new { Result = 1, Records = Acc })); }