Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        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());
            }
        }
Exemplo n.º 3
0
 // GET: api/Phones
 public IEnumerable <Phone> GetPhones()
 {
     return(_phoneService.GetAll());
 }
Exemplo n.º 4
0
 public IEnumerable <Phone> GetAll()
 {
     return(_service.GetAll());
 }
Exemplo n.º 5
0
 public IEnumerable <PhoneGetDTO> Get()
 {
     return(phoneService.GetAll());
 }
Exemplo n.º 6
0
 public IEnumerable <PhoneViewModel> GetAll()
 {
     return(_iMapper.Map <IEnumerable <PhoneViewModel> >(_iPhoneService.GetAll()));
 }