public bool CreateUser(User UserDetail) { EncryptionData encryptData = new EncryptionData(); UserDetail.Password = encryptData.encrypt(UserDetail.Password); _context.Users.Add(UserDetail); _context.SaveChanges(); return(true); }
public List <User> Login(User LoginDetail) { EncryptionData encryptData = new EncryptionData(); LoginDetail.Password = encryptData.encrypt(LoginDetail.Password); var LoginUser = _context.Users.Where(a => a.Username == LoginDetail.Username && a.Password == LoginDetail.Password).ToList(); if (LoginUser.Count > 0) { LoginUser[0].Password = encryptData.Decrypt(LoginUser[0].Password); } return(LoginUser); }