Пример #1
0
 public void Add(ref classes.Contract item)
 {
     DAL_DB.Contract contractDB = Mapper.Map <DAL_DB.Contract>(item);
     context.Contract.Add(contractDB);
     context.SaveChanges();
     item.ClientID = contractDB.ClientID;
 }
Пример #2
0
        public void Delete(classes.Contract item)
        {
            DAL_DB.Contract        contractDB = Mapper.Map <DAL_DB.Contract>(item);
            List <DAL_DB.Building> blds       = new List <DAL_DB.Building>(context.Building.Cast <DAL_DB.Building>());

            foreach (DAL_DB.Building buildingToDel in blds)
            {
                if (buildingToDel.ContractNumber == contractDB.ContractNumber)
                {
                    context.Building.Remove(buildingToDel);
                }
            }
            context.Contract.Remove(context.Contract.First(ctr => ctr.ContractNumber == contractDB.ContractNumber));
            context.SaveChanges();
        }
Пример #3
0
 public void Update(classes.Contract contract)
 {
     DAL_DB.Contract contractDB = context.Contract.First(ctr => ctr.ContractNumber == contract.ContractNumber);
     contractDB.DateOfSignature = contract.DateOfSignature;
     context.SaveChanges();
 }