Example #1
0
        public FrmConsultarProducto()
        {
            InitializeComponent();
            productosService = new ProductosService(ConfigConnection.connectionString, ConfigConnection.ProviderName);

            proveedorService = new ProveedorService(ConfigConnection.connectionString, ConfigConnection.ProviderName);
        }
Example #2
0
 public FrmRegistrarVenta()
 {
     InitializeComponent();
     clienteService        = new ClienteService(ConfigConnection.connectionString, ConfigConnection.ProviderName);
     productosService      = new ProductosService(ConfigConnection.connectionString, ConfigConnection.ProviderName);
     facturaService        = new FacturaService(ConfigConnection.connectionString, ConfigConnection.ProviderName);
     detalleFacturaService = new DetalleFacturaService(ConfigConnection.connectionString, ConfigConnection.ProviderName);
     LisDetalleAux         = new List <Productos>();
     LisFacturaAux         = new List <Factura>();
     LisFactura            = new List <Factura>();
 }
        public List <ProductoResponse> GetProductos([FromQuery] int?page)
        {
            const int pageSize = 2;

            var productos = new ProductosService().GetProductos();

            var productosPaginados = productos.Skip((page ?? 0) * pageSize)
                                     .Take(pageSize)
                                     .ToList();

            return(productosPaginados);
        }
        public void CrearProductoTest()
        {
            var model = new Producto();
            model.Id = 0;
            model.Title ="Test";
            model.Description ="Test";
            model.Marca = "Test";

            var repository = Substitute.For<IProductosRepositorio>();

            var service = new ProductosService(repository);

            service.Crear(model);

            //Assert
            repository.Received().Crear(model);
        }
        public void CrearDetalleTest()
        {
            var model = new Review();
            model.Id = 0;
            model.Productos = new Producto() { Id = 0, Title = "Test", Description = "test" ,Marca="test"};
            model.Sku = 5;
            model.Comment = "Producto de prueba";

            var repository = Substitute.For<IProductosRepositorio>();

            var service = new ProductosService(repository);

            service.CrearReview(model);

            //Assert
            repository.Received().CrearReview(model);
        }
Example #6
0
        public ActionResult <ResultResponse> ObtenerProductos([FromHeader] string producto)
        {
            ValidarRequestService validacionService = new ValidarRequestService(_telemetry);
            ResultResponse        resultValidate    = validacionService.CheckRequest(producto);

            if (!string.IsNullOrEmpty(resultValidate.IdError))
            {
                return(BadRequest(resultValidate.MessageError));
            }

            PalindromoHelper  palindrome       = new ValidarBusqueda(producto);
            PalindromoService objectPalindromo = new PalindromoService(palindrome, _telemetry);
            bool resultPalindromo = Convert.ToBoolean(objectPalindromo.ValidarPalindromo(producto).IsPalindromo);

            ProductosService objectService = new ProductosService(_telemetry);
            ResultResponse   registros     = objectService.ObtenerProducto(producto, resultPalindromo);

            return(Ok(registros));
        }
Example #7
0
        public ActionResult GetAllProductos(int page, int start, int limit, string sort, string dir, long _dc, string callback, string condicion = null, string codigo = null)
        {
            var filter = new PagingInfo
            {
                page     = page,
                start    = start,
                limit    = limit,
                sort     = sort,
                dir      = dir,
                _dc      = _dc,
                callback = callback,
                search   = condicion
            };
            var service  = new ProductosService();
            var jsondata = service.GetAllProductos(filter, codigo);
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            string callback1 = callback + "(" + javaScriptSerializer.Serialize(jsondata) + ");";

            return(JavaScript(callback1));
        }
 public ProductosController(ProductosService productosService)
 {
     _productosService = productosService;
 }