public ActionResult Edit([Bind(Include = "PwdId,DateCreated,DateTimeStamp,Completed,Category,SubCategory,Account_Name,URI,Location,Password_1,Account_Holder_First_Name,Account_Holder_Last_Name,Email_Address_Main,DOB,Tel,Mobile,Address_1,Address_2,Town,Region,Country,Post_Code_Zip,Question_1,Answer_1,Question_2,Answer_2,Question_3,Answer_3,Question_4,Answer_4,Question_5,Answer_5,Mother_Maiden_Name,Notes,Misc")] Pwd pwd) { if (ModelState.IsValid) { db.Entry(pwd).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pwd)); }
public async Task <bool> UpdatePassword(Password password) { var pass = await _context.Passwords.Include(u => u.User).FirstOrDefaultAsync(x => x.Id == password.Id); if (pass == null) { return(false); } var key = Convert.ToBase64String(pass.User.UserKey); if (pass.PasswordEncrypt != password.PasswordEncrypt) { password.PasswordEncrypt = _encryptPass.EncryptString(password.PasswordEncrypt, key); } _context.Entry(pass).CurrentValues.SetValues(password); return(true); }