Exemple #1
0
        // GET: ModelController/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var carModel = await _repo.FindById(id);

            var model = _mapper.Map <Model, CreateModelVM>(carModel);

            if (model == null)
            {
                return(NotFound());
            }

            return(View(model));
        }
Exemple #2
0
        public async Task <IActionResult> GetModel(int id)
        {
            try
            {
                var model = await _modelRepository.FindById(id);

                if (model == null)
                {
                    return(NotFound());
                }
                var response = _mapper.Map <ModelDTO>(model);
                return(Ok(response));
            }
            catch (Exception e)
            {
                return(InternalError($"{e.Message} - {e.InnerException}"));
            }
        }
Exemple #3
0
 public Optional <T> FindById(Guid itemGuid)
 {
     try
     {
         return(_modelRepository.FindById(itemGuid));
     }
     catch (Exception e)
     {
         return(Codes.DbError(e.Message));
     }
 }
 public Model FindById(int id)
 {
     return(_modelRepository.FindById(id));
 }