Example #1
0
        public async Task <IActionResult> CreateProduct_inmem([FromBody] Production.Product_inmem value)
        {
            _db.Production_Product_inmem.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }
Example #2
0
        public async Task <IActionResult> EditProduct_inmem(int productID, [FromBody] Production.Product_inmem value)
        {
            var existing = await _db.Production_Product_inmem.FirstOrDefaultAsync(x => x.ProductID == productID);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.ProductID             = value.ProductID;
            existing.Name                  = value.Name;
            existing.ProductNumber         = value.ProductNumber;
            existing.MakeFlag              = value.MakeFlag;
            existing.FinishedGoodsFlag     = value.FinishedGoodsFlag;
            existing.Color                 = value.Color;
            existing.SafetyStockLevel      = value.SafetyStockLevel;
            existing.ReorderPoint          = value.ReorderPoint;
            existing.StandardCost          = value.StandardCost;
            existing.ListPrice             = value.ListPrice;
            existing.Size                  = value.Size;
            existing.SizeUnitMeasureCode   = value.SizeUnitMeasureCode;
            existing.WeightUnitMeasureCode = value.WeightUnitMeasureCode;
            existing.Weight                = value.Weight;
            existing.DaysToManufacture     = value.DaysToManufacture;
            existing.ProductLine           = value.ProductLine;
            existing.Class                 = value.Class;
            existing.Style                 = value.Style;
            existing.ProductSubcategoryID  = value.ProductSubcategoryID;
            existing.ProductModelID        = value.ProductModelID;
            existing.SellStartDate         = value.SellStartDate;
            existing.SellEndDate           = value.SellEndDate;
            existing.DiscontinuedDate      = value.DiscontinuedDate;
            existing.ModifiedDate          = value.ModifiedDate;

            _db.Production_Product_inmem.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }