Пример #1
0
        // GET: ModelController
        public async Task <ActionResult> Index()
        {
            var models = await _repo.FindAll();

            var model = _mapper.Map <List <Model>, List <ModelVM> >(models);

            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> GetModels()
        {
            try
            {
                var models = await _modelRepository.FindAll();

                var response = _mapper.Map <IList <ModelDTO> >(models);
                return(Ok(response));
            }
            catch (Exception e)
            {
                return(InternalError($"{e.Message} - {e.InnerException}"));
            }
        }
Пример #3
0
 public List <T> FindAll()
 {
     return(_modelRepository.FindAll());
 }
Пример #4
0
        //Read
        public IEnumerable <Model> GetAll()
        {
            var result = modelRepository.FindAll();

            return(result);
        }