public IActionResult UpdateForUser(UpdateForUserDto user) { var result = _userService.UpdateForUser(user); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public async Task <IActionResult> UpdateUser(int id, UpdateForUserDto userForUpdate) { if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var userFromRepo = await _repo.GetUser(id); _mapper.Map(userForUpdate, userFromRepo); if (await _repo.SaveAll()) { return(NoContent()); } else { throw new Exception($"update user with {id} Filed!"); } }
public IResult UpdateForUser(UpdateForUserDto user) { byte[] passwordHash; byte[] passwordSalt; HashingHelper.CreatePasswordHash(user.Password, out passwordHash, out passwordSalt); var userInfo = new User() { UserId = user.UserId, FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, PasswordHash = passwordHash, PasswordSalt = passwordSalt, Status = true }; _ıuserDal.Update(userInfo); return(new SuccessResult()); }