Beispiel #1
0
        public override async Task <U> Add <U, V>(V entity) where U : class where V : class
        {
            DtoGamme gamme = await BsGamme.GetById <DtoGamme>(BuildMapper <V, DtoOrderContent>().Map <DtoOrderContent>(entity).IdGamme);

            if (gamme.Stock != 0)
            {
                BsGamme.UpdateStock(BuildMapper <DtoGamme, Gamme>().Map <Gamme>(gamme), new DtoStockHisto()
                {
                    Date = DateTime.Now, Stock = (int)gamme.Stock - BuildMapper <V, DtoOrderContent>().Map <DtoOrderContent>(entity).Quantity
                });
            }
            return(BuildMapper <OrderContent, U>().Map <U>(await DpOrderContent.Add(BuildMapper <V, OrderContent>().Map <OrderContent>(entity))));
        }