Ejemplo n.º 1
0
        public void CreateSupply(BLL.BusinessModels.Supply NewSupply)
        {
            DAL.Supply sup = new DAL.Supply()
            {
                Cost = NewSupply.Cost, ApplicantId = NewSupply.ApplicantId, ApplicationDate = DateTime.Now, DeliveryDate = NewSupply.DeliveryDate, ProviderId = NewSupply.ProviderId, WarehouseId = NewSupply.WarehouseId, StatusId = 1
            };
            List <DAL.SupplyLine> NewLines = new List <DAL.SupplyLine>();

            foreach (BusinessModels.SupplyLine i in NewSupply.Lines)
            {
                NewLines.Add(new DAL.SupplyLine()
                {
                    CommodityId = i.CommodityId, Quantity = i.Quantity, Cost = i.Cost * i.Quantity
                });
            }
            sup.SupplyLine = NewLines;
            repos.Supplies.Create(sup);
            repos.Save();
            NewSupply.Id = repos.Supplies.GetList().Last().Id;
        }
Ejemplo n.º 2
0
 public BLL.BusinessModels.Supply getLastSupply(BLL.BusinessModels.Supply NewSupply)
 {
     NewSupply.Id = repos.Supplies.GetList().Last().Id;
     return(NewSupply);
 }