public async Task <IHttpActionResult> GetMachines() { //instantiate service MachineService service = CreateMachineService(); List <MachineListItem> machines = await service.GetAllMachines(); return(Ok(machines)); //200 }
public IActionResult GetMachines() { try { var machines = _machineService.GetAllMachines(); //TODO: Remove this mapping var machineModels = _mapper.Map <IEnumerable <MachineModel> >(machines); return(Ok(machineModels)); } catch { return(BadRequest("Error: Machines not found")); } }