public async Task <IActionResult> GetDriverList([FromBody] GetDriverRequest req) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } GetDriverListResponse resp = new GetDriverListResponse(); PortalUser user = await repository.AuthenticateUserToken(req.CurrentUser.UserId, req.CurrentUser.UserToken); if (user == null) { return(NotFound()); } var drivers = await repository.GetDriversByCompanyId(user.CompanyId); foreach (Driver d in drivers) { resp.DriverList.Add(new DriverListModel { DriverId = d.DriverId, DriverFullName = d.FirstName + ' ' + d.LastName }); } return(Ok(resp)); }
public NegotiatedContentResult <GetDriverListResponse> PostGetDriverList([FromBody] GetDriverListRequest request) { GetDriverListResponse resp = _ordersServices.GetDriverList(request); return(Content(HttpStatusCode.OK, resp)); }