public bool ChangeProfile(UserChangeProfile userChangeProfile) { using var unitOfWork = new UnitOfWork(); var userRepo = unitOfWork.GetRepository <User>(); var user = userRepo.FirstOrDefault(x => x.Username == userChangeProfile.Username); if (user == null) { return(false); } user.FacebookId = userChangeProfile.FacebookId; user.GoogleId = userChangeProfile.GoogleId; user.Email = userChangeProfile.Email; user.UserType = userChangeProfile.UserType; userRepo.Update(user); unitOfWork.Save(); return(true); }
public IActionResult ChangeProfile([FromBody] UserChangeProfile userChangeProfile) { var loginResult = _userService.ChangeProfile(userChangeProfile); return(!loginResult?Unauthorized() as IActionResult : new OkObjectResult(true)); }