public async Task <ResponseUserDto> UpdateUser(UpdateProfileDtoDto model) { var result = await _shopUserRepository.UpdateUser(model); if (result != null) { return(new ResponseUserDto() { IsSuccess = true, Error = "", Address = result.Address, CompanyName = result.CompanyName, Email = result.Email, FullName = result.FullName, Id = result.Id, IsSeller = result.IsSeller, PhoneNumber = result.PhoneNumber, ProfilePicture = result.ProfilePicture }); } else { return(new ResponseUserDto() { IsSuccess = false, Error = "خطایی رخ داده است...", Id = 0, IsSeller = false }); } }
public async Task <ShopUser> UpdateUser(UpdateProfileDtoDto updateProfile) { try { var user = await GetUser(updateProfile.Id); user.Address = updateProfile.Address; user.CompanyName = updateProfile.CompanyName; user.Email = updateProfile.Email; user.FullName = updateProfile.FullName; user.PhoneNumber = updateProfile.Phone; user.ProfilePicture = updateProfile.ProfilePicture; await _context.SaveChangesAsync(); return(user); } catch (Exception) { return(null); } }