Exemplo n.º 1
0
 public void CreateUnit(UnitModel unitModel)
 {
     using (var db = new DBNikoletaContext())
     {
         db.Units.Add(unitModel);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void AddProduct(ProductModel product)
 {
     using (var db = new DBNikoletaContext())
     {
         db.Products.Add(product);
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void DeleteUnit(string code)
 {
     using (var db = new DBNikoletaContext())
     {
         UnitModel unit = db.Units.FirstOrDefault(u => u.Code == code);
         db.Units.Remove(unit);
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
        public void SetCoeficientPrice(decimal coeficient)
        {
            using (var db = new DBNikoletaContext())
            {
                SettingModel setting = db.Settings.FirstOrDefault();
                setting.CoeficientPrice = coeficient;

                db.SaveChanges();
            }
        }
Exemplo n.º 5
0
 public void UpdateUnit(string newDescription, UnitModel unitToUpdate)
 {
     using (var db = new DBNikoletaContext())
     {
         UnitModel unit = db.Units.FirstOrDefault(u => u.Code == unitToUpdate.Code);
         unit.Description = newDescription;
         db.SaveChanges();
     }
 }