// POST public Quotation CreateQuotation(Quotation quo) { // serialize counter += 1; if (String.IsNullOrEmpty(quo.CodClient) || String.IsNullOrEmpty(quo.CodProd) || quo.Quantity <= 0) { Console.Out.WriteLine("CodProd NULL o CodClient NULL o Cantidad <= 0 "); throw new Exception("CodProd NULL o CodClient NULL o Cantidad <= 0"); } PricingBook myBook = _priceBookService.GetAllPrices().Result; List <Product> myPriceBook = myBook.Content; Product precioProd = myPriceBook.Find(pr => pr.ProductId == quo.CodProd); quo.Id = counter; //quo.Price = precioProd != null ? (precioProd.PromotionPrice != 0 ? precioProd.PromotionPrice : precioProd.Price) : 0; quo.Sale = false; _dbContext.AddQuotation(DTOMappers.MapGroupLD(quo)); return(quo); }
public Quotation UpdateQuotation(Quotation quo) { Data.Models.Quotation qu = _dbContext.UpdateQuotation(DTOMappers.MapGroupLD(quo)); return(DTOMappers.MapQuotationDL(qu)); }
public Quotation CreateQuotation(Quotation quo) { _dbContext.AddQuotation(DTOMappers.MapGroupLD(quo)); return(quo); }