Example #1
0
 public static List <Price> GetAll()
 {
     try
     {
         using (MekoritDBEntities db = new MekoritDBEntities())
         {
             return(db.Prices.ToList());
         }
     }
     catch
     {
         throw;
     }
 }
Example #2
0
 public static void Update(int priceId)
 {
     try
     {
         using (MekoritDBEntities db = new MekoritDBEntities())
         {
             db.Prices.Remove(db.Prices.Find(priceId));
             db.SaveChanges();
         }
     }
     catch
     {
         throw;
     }
 }
Example #3
0
 public static Price Add(Price price)
 {
     try
     {
         using (MekoritDBEntities db = new MekoritDBEntities())
         {
             price = db.Prices.Add(price);
             db.SaveChanges();
             return(price);
         }
     }
     catch
     {
         throw;
     }
 }
Example #4
0
 public static Price Update(Price price)
 {
     try
     {
         using (MekoritDBEntities db = new MekoritDBEntities())
         {
             db.Prices.Attach(price);
             db.Entry(price).State = EntityState.Modified;
             db.SaveChanges();
             return(price);
         }
     }
     catch
     {
         throw;
     }
 }