public void CreateUnit(UnitModel unitModel) { using (var db = new DBNikoletaContext()) { db.Units.Add(unitModel); db.SaveChanges(); } }
public void AddProduct(ProductModel product) { using (var db = new DBNikoletaContext()) { db.Products.Add(product); db.SaveChanges(); } }
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(); } }
public void SetCoeficientPrice(decimal coeficient) { using (var db = new DBNikoletaContext()) { SettingModel setting = db.Settings.FirstOrDefault(); setting.CoeficientPrice = coeficient; db.SaveChanges(); } }
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(); } }