Пример #1
0
 //Get the details of a particular coffe
 public TblCoffe GetCoffeData(int id)
 {
     try
     {
         TblCoffe coffe = db.TblCoffe.Find(id);
         return(coffe);
     }
     catch
     {
         throw;
     }
 }
Пример #2
0
 //To Update the records of a particluar coffe
 public int UpdateCoffe(TblCoffe coffe)
 {
     try
     {
         db.Entry(coffe).State = EntityState.Modified;
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
Пример #3
0
 //To Add new coffe record
 public int AddCoffe(TblCoffe coffe)
 {
     try
     {
         db.TblCoffe.Add(coffe);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
Пример #4
0
 //To Delete the record of a particular coffe
 public int DeleteCoffe(int id)
 {
     try
     {
         TblCoffe coffe = db.TblCoffe.Find(id);
         db.TblCoffe.Remove(coffe);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }