public HttpResponseMessage GetAll() { try { ItemsResponse <Phone> response = new ItemsResponse <Phone>(); response.Items = _phoneService.GetAll(); return(Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public async Task <IActionResult> GetAllPhones() { var phones = await _phoneService.GetAll(); if (phones.Any()) { var mapped = _mapper.Map <List <PhoneModel> >(phones); return(Ok(mapped)); } else { return(BadRequest()); } }
// GET: api/Phones public IEnumerable <Phone> GetPhones() { return(_phoneService.GetAll()); }
public IEnumerable <Phone> GetAll() { return(_service.GetAll()); }
public IEnumerable <PhoneGetDTO> Get() { return(phoneService.GetAll()); }
public IEnumerable <PhoneViewModel> GetAll() { return(_iMapper.Map <IEnumerable <PhoneViewModel> >(_iPhoneService.GetAll())); }