Closed rajeshpandalss closed 7 years ago
Hi Jonathan,
Please review the committed changes.
I think throwing NotFoundException will be more apt in case the user is not found. Also, if the service fails we should be throwing Internal Server error. Your thoughts?
public async Task
if (user == null)
throw new NotFoundException("User Id not found.");
try
{
user.IsActive = changeAccountStatusModel.IsActive == null ? user.IsActive : (bool)changeAccountStatusModel.IsActive;
user.IsVerifyRequired = changeAccountStatusModel.IsVerifyRequired == null ? user.IsVerifyRequired : (bool)changeAccountStatusModel.IsVerifyRequired;
var result = await _userService.UpdateUserAsync(userId, user);
return result;
}
catch (Exception)
{
throw new ApiException(HttpStatusCode.InternalServerError.ToString(), "Unknown error occured. Please retry.");
}
}
Please review.