public async Task <HttpResponseMessage> Add(PRODUIT Prod)
        {
            try
            {
                STOCK s = new STOCK();
                if (Prod == null)
                {
                    int id = produitService.GetProduits().Take(1).FirstOrDefault().ID;
                    Prod              = produitService.GetProduit(id);
                    Prod.NAMEP        = "aa74rdf";
                    Prod.DESCRIPTIONS = "bbb963ff";
                }
                bool IsAdded = produitService.Ajouter(Prod);

                s.ID         = Prod.ID;
                s.ID_PRODUCT = Prod.ID;
                s.QUANTITY   = "0";

                bool IsAdded2 = stockService.Ajouter(s);
                return(Request.CreateResponse(HttpStatusCode.OK, IsAdded));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Beispiel #2
0
        public async Task <HttpResponseMessage> Add(STOCK stock1)
        {
            try
            {
                if (stock1 == null)
                {
                    int id = stockService.GetSTOCKS().Take(1).FirstOrDefault().ID;
                    stock1          = stockService.GetSTOCK(id);
                    stock1.QUANTITY = "741";
                }

                bool IsAdded = stockService.Ajouter(stock1);
                return(Request.CreateResponse(HttpStatusCode.OK, IsAdded));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }