示例#1
0
 public Boolean Add(LoaiMon lm)
 {
     try
     {
         if (_db.LoaiMons.Find(lm.IDLoaiMon) == null)
         {
             _db.LoaiMons.Add(lm);
             _db.SaveChanges();
             return(true);
         }
         throw new Exception("IDLoaiMon đã tồn tại!");
     }
     catch (DBConcurrencyException ex)
     {
         throw ex;
     }
 }
示例#2
0
 public Boolean Add(ThucDon td)
 {
     try
     {
         if (_db.ThucDons.Find(td.IDMon) == null)
         {
             _db.ThucDons.Add(td);
             _db.SaveChanges();
             return(true);
         }
         throw new Exception("IDMon đã tồn tại!");
     }
     catch (DBConcurrencyException ex)
     {
         throw ex;
     }
 }
示例#3
0
 public Boolean Add(DatMon dm)
 {
     try
     {
         DatMon datMon = _db.DatMons.Find(dm.IDDatMon);
         if (datMon == null)
         {
             _db.DatMons.Add(dm);
             _db.SaveChanges();
             return(true);
         }
         throw new Exception("IDDatMon đã tồn tại!");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#4
0
 public Boolean Add(ChiTietDatMon ctdm)
 {
     try
     {
         _db.ChiTietDatMons.Add(ctdm);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }