public async Task <IHttpActionResult> Add(AddOrUpdateUserRequest request) { var user = await _userManager.GetUserAsync(User); request.TenantId = user.TenantId; return(Ok(await _mediator.Send(request))); }
public Response <int> AddOrUpdateUsers(AddOrUpdateUserRequest request) { Response <int> response = new Response <int>(); if (request == null || request.UserCollection == null || !request.UserCollection.Any()) { ArgumentNullException ex = new ArgumentNullException("AddOrUpdateUser request"); LogError(ex); response.ErrorCode = ErrorCode.Argument; response.Exception = ex; return(response); } try { UserAccessor accessor = new UserAccessor(); response.Result = accessor.AddOrUpdateUsers(request.UserCollection); response.IsSuccess = true; } catch (Exception ex) { LogError(ex); response.IsSuccess = false; response.ErrorCode = ErrorCode.Technical; } return(response); }