Example #1
0
 public Boolean Add(Xe x)
 {
     try
     {
         if (_db.Xes.Find(x.IDXe) == null)
         {
             _db.Xes.Add(x);
             _db.SaveChanges();
             return(true);
         }
         throw new Exception("IDXe đã tồn tại!");
     }
     catch (DBConcurrencyException ex)
     {
         throw ex;
     }
 }
Example #2
0
 public Boolean Add(LoaiXe lx)
 {
     try
     {
         if (_db.LoaiXes.Find(lx.IDLoaiXe) == null)
         {
             _db.LoaiXes.Add(lx);
             _db.SaveChanges();
             return(true);
         }
         throw new Exception("IDLoaiXe đã tồn tại!");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
 public Boolean Add(ThueXe tx)
 {
     try
     {
         if (_db.ThueXes.AsEnumerable().SingleOrDefault(it => it.IDThueXe == tx.IDThueXe) == null)
         {
             _db.ThueXes.Add(tx);
             _db.SaveChanges();
             return(true);
         }
         throw new Exception("IDThueXe đã tồn tại!");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
 public Boolean Add(ChiTietThueXe cttx)
 {
     try
     {
         _db.ChiTietThueXes.Add(cttx);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }