public async Task <IWrappedResponse> GetByCustomerId(int customerId) { var user = _userRepo.FindAll() .ProjectTo <User>(Mapper.ConfigurationProvider) .SingleOrDefault(); user.Role = AuthData.GetUserRole(); var customerResult = (IWrappedResponse <Customer>) await _customersService.GetById(customerId); if (customerResult.ResultType == ResultType.NotFound) { return(NotFound <User>(customerId)); } var customers = new[] { customerResult.Data }; var postingAccountsServiceResponse = (IWrappedResponse <IEnumerable <PostingAccount> >) await _postingAccountsService.GetByCustomerId(customerId); var postingAccounts = postingAccountsServiceResponse.Data; var permissions = Array.Empty <UserPermission>(); user.Customers = customers; user.PostingAccounts = postingAccounts; user.Permissions = permissions; return(Ok(user)); }
public IActionResult GetById(int id) { var result = _customersService.GetById(id); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public async Task <IActionResult> Get(int customerId, CancellationToken cancellationToken = default) { var customer = await _customersService.GetById(customerId, cancellationToken); if (customer == null) { return(NotFound()); } return(Ok(customer)); }
public Task <ActionResult <Customer> > GetById(int id) { return(_customersService.GetById(id).Convert <Customer>(this)); }
public IHttpActionResult getById(int id) { return(Ok(customerService.GetById(id))); }