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