コード例 #1
0
        protected override void ToViewModel()
        {
            CategoriaLivro categoria = (CategoriaLivro)Entidades[typeof(CategoriaLivro).Name];

            CategoriaLivroModel vm = new CategoriaLivroModel
            {
                Id      = categoria.Id,
                Nome    = categoria.Nome,
                Inativo = categoria.Inativo
            };

            _viewModel = vm;
        }
コード例 #2
0
        protected override void ToEntidade()
        {
            CategoriaLivroModel vm = (CategoriaLivroModel)ViewModel;

            CategoriaLivro ctg = new CategoriaLivro
            {
                Nome = vm.Nome,
                Id   = vm.Id
            };

            _entidades = new Dictionary <string, object>
            {
                [typeof(CategoriaLivro).Name] = ctg
            };
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: RaiBSilva/LES
        public IActionResult AdicionarCategoria(CategoriaLivroModel categoria)
        {
            _vh = new CategoriaLivroViewHelper
            {
                ViewModel = categoria
            };

            CategoriaLivro ctgNova = (CategoriaLivro)_vh.Entidades[typeof(CategoriaLivro).Name];
            string         msg     = _facade.Cadastrar(ctgNova);

            if (!String.IsNullOrEmpty(msg))
            {
                TempData["Alert"] = msg;
            }

            return(RedirectToAction(nameof(ConfigLoja)));
        }