public CategoriasController() : base()
        {
            _contexto = new Contexto();
            var repository = new CategoriaRepository(_avikaDB, _logger);

            this._servicio = new ServicioCategoria(repository);
        }
Exemple #2
0
        public void CreateCategory_WithCategoryEventFieldNotEmpty()
        {
            var Servicio = new ServicioCategoria();

            var categoria = new Categoria()
            {
                CategoriaEvento = "Evento 1"
            };

            int result = Servicio.CrearNuevoAsync(categoria).Result;

            Assert.IsTrue(result == 1);
        }
Exemple #3
0
        public void No_CreateCategory_WithCategoryEventFieldEmpty()
        {
            var Servicio = new ServicioCategoria();

            var categoria = new Categoria()
            {
                // Category Field Is Empty in order to recieve an error
                //CategoriaEvento = "Evento 1"
            };

            int result = Servicio.CrearNuevoAsync(categoria).Result;

            Assert.IsTrue(result == 0);
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            //_context.Categoria.Add(Categoria);
            //await _context.SaveChangesAsync();

            var Servicio = new ServicioCategoria(_context);
            await Servicio.CrearNuevoAsync(Categoria);

            return(RedirectToPage("./Index"));
        }
        public bool EliminarCategoria(string clave)
        {
            ServicioCategoria srv = new ServicioCategoria();

            return(srv.EliminarCategoria(clave));
        }
        public bool EditarCategoria(Categoria categoria)
        {
            ServicioCategoria srv = new ServicioCategoria();

            return(srv.EditarCategoria(categoria));
        }
        public bool InsertarCategoria(Categoria entidad)
        {
            ServicioCategoria srv = new ServicioCategoria();

            return(srv.InsertarCategoria(entidad));
        }
        public ListaCategoria ObtenerCategoria()
        {
            ServicioCategoria srv = new ServicioCategoria();

            return(srv.ObteberCategoria());
        }