public HttpResponseMessage Get(int id) { try { ItemResponse <Phone> response = new ItemResponse <Phone>(); response.Item = _phoneService.Get(id); return(Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public async Task <ActionResult> Get() { var phone = _mapper.Map <IList <PhoneDto> >(await _phoneService.Get()); return(Response(phone)); }