public async Task <ResponseDTO <List <Item> > > GetAllItems(ItemRequest itemRequest)
 {
     try
     {
         return(new ResponseDTO <List <Item> >()
         {
             IsSuccess = true,
             ReturnValue = await _itemRepo.GetAllItems(itemRequest),
             Exception = null,
             ErrorCode = null,
             CorrelationId = null,
             ErrorMessage = null,
             Errors = null
         });
     }
     catch (Exception ex)
     {
         return(new ResponseDTO <List <Item> >()
         {
             IsSuccess = false,
             ReturnValue = null,
             Exception = ex,
             ErrorCode = null,
             CorrelationId = null,
             ErrorMessage = ex.Message,
             Errors = null
         });
     }
 }
Ejemplo n.º 2
0
        public ActionResult <IEnumerable <ItemReadDto> > GetAllItems()
        {
            var items = _item.GetAllItems();

            return(Ok(_mapper.Map <IEnumerable <ItemReadDto> >(items)));
        }