Esempio n. 1
0
        private void FillSomeData()
        {
            ObservableCollection <ProductV2> list = new ObservableCollection <ProductV2>();

            for (int i = 1; i <= 10; i++)
            {
                ProductV2 p = new ProductV2();
                p.additional                 = "additional" + i;
                p.catalogTruId               = "catalogTruId" + i;
                p.description                = "description" + i;
                p.exciseAmount               = i * 100;
                p.exciseRate                 = 10;
                p.kpvedCode                  = "kpvedcode";
                p.ndsAmount                  = i * 110;
                p.ndsRate                    = 10;
                p.priceWithoutTax            = i * 1000;
                p.priceWithTax               = 1.1f * 1.1f * i * 1000;
                p.productDeclaration         = "productDecl" + i;
                p.productNumberInDeclaration = "productNumberInDec" + i;
                p.quantity                   = 1;
                p.rowNumber                  = i;
                p.tnvedName                  = "tnvedName";
                p.truOriginCode              = (i - 1) % 6 + 1;
                p.turnoverSize               = i * 1000;
                p.unitCode                   = "unitCOde" + i;
                p.unitNomenclature           = "UnitNimenclature" + i;
                p.unitPrice                  = 1000;
                AddRow(p);
            }
        }
Esempio n. 2
0
 public IActionResult Post([FromBody] ProductV2 product)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     else
     {
         _productsDbContext.Products.Add(product);
         _productsDbContext.SaveChanges(true);
         return(StatusCode(StatusCodes.Status201Created));
     }
 }
Esempio n. 3
0
 public IActionResult Put(int id, [FromBody] ProductV2 product)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     if (id != product.Id)
     {
         return(BadRequest());
     }
     try
     {
         _productsDbContext.Products.Update(product);
         _productsDbContext.SaveChanges(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         NotFound("No Record found againt this Id");
     }
     return(Ok("Product Updated..."));
 }
Esempio n. 4
0
 internal void fillByProduct(ProductV2 selectedItem)
 {
     productGrid.DataContext = selectedItem;
 }
Esempio n. 5
0
 private void AddRow(ProductV2 p)
 {
     sourceList.Add(p);
 }