public long AddProductHeader(ProdcutRequest prdReq) { Product prd = new Product(); prd.Category = _context.categories.FirstOrDefault(x => x.id == prdReq.Category_Id); prd.Fabric = _context.productfabric.FirstOrDefault(x => x.Id == prdReq.Fabric_Id); prd.StichingType = _context.productstichingtype.FirstOrDefault(x => x.id == prdReq.StichingTypeId); prd.Description = prdReq.Description; prd.Cost_Price = prdReq.Cost_Price; prd.Vendor = _context.vendor.FirstOrDefault(x => x.Id == prdReq.VendorId); prd.AddDate = DateTime.UtcNow; prd.AddTime = DateTime.UtcNow.TimeOfDay; prd.UpdateTime = null; prd.UpdateDate = null; string folderForProductRelatedImages = "prd_" + DateTime.Now.ToString("yyyMMddHHmmss"); prd.ProductImageDir = folderForProductRelatedImages; prd.IsActive = false; prd.TraderMarginRupees = prdReq.TraderMarginRupees; prd.VendorShippingCost = prdReq.VendorShippingCost; prd.TraderPrice = prdReq.TraderPrice; prd.CustomerShippingCost = prdReq.CustomerShippingCost; prd.CustomerMarginRupees = prdReq.CustomerMarginRupees; prd.CustomerPrice = prdReq.CustomerPrice; _context.product.Add(prd); _context.SaveChanges(); return(prd.Product_ID); }
public IActionResult AddProductHeader(ProdcutRequest prdReq) { //List<ProdcutDesignDTO> prdList = JsonConvert.DeserializeObject<List<ProdcutDesignDTO>>(productDesignList); ProductIDResponse prr = new ProductIDResponse() { ProductId = _prd.AddProductHeader(prdReq), message = "Product Added" }; return(Ok(prr)); }
public string UpdateProduct(ProdcutRequest prdReq) { throw new NotImplementedException(); }