Exemplo n.º 1
0
        public ActionResult Details(int id)
        {
            var model = db.Get(id);

            if (model == null)
            {
                return(View("NotFound"));
            }
            var viewmodel = MapModelToViewmodel(model);

            return(View(viewmodel));
        }
Exemplo n.º 2
0
        public async Task <ResourceModel> Get(string alias, string language)
        {
            if (alias.IsNullOrEmpty())
            {
                return(new ResourceModel());
            }

            var resourceResult = await translationRepository.Get(alias) ?? new Resource();

            var result = new ResourceModel
            {
                Alias       = resourceResult.Alias,
                Description = resourceResult.Description,
                Language    = language,
                Translation = resourceResult.Translations.FirstOrDefault(y => y.Language == language)?.Value
            };

            return(result);
        }
Exemplo n.º 3
0
        public TranslationViewModel Find(long id)
        {
            var viewModel = _mapper.Map <TranslationViewModel>(_translationRepository.Get(id));

            return(viewModel);
        }