Exemple #1
0
 public bool deleteContract(int id)
 {
     TourDAO tourDAO = new TourDAO();
     Contract contract = selectContract(id);
     try
     {
         Tour oldTour = _entities.Tours.Find(contract.idTour);
         _entities.Entry(oldTour).State = EntityState.Modified;
         _entities.Contracts.Remove(contract);
         _entities.SaveChanges();
     }
     catch
     {
         return false;
     }
     return true;
 }
Exemple #2
0
        public bool addBronContract(int idTour, Contract contract)
        {
            try
            {
                contract.Tour = GetContractTour(idTour);
                TourDAO tourDAO = new TourDAO();
                Tour oldTour = _entities.Tours.Find(idTour);

                    _entities.Contracts.Add(contract);
                    _entities.Entry(oldTour).State = EntityState.Modified;
                    _entities.SaveChanges();

            }
            catch
            {
                return false;
            }
            return true;
        }