public void ShopAdd(string name, string Address, int ShopType) { Shop shop = new Shop(); shop.Name = name; shop.Address = Address; shop.ShopTypeId = ShopType; db.Add(shop); db.SaveChanges(); }
public void ProductAdd(string name, string company, string image_url) //პროდუქტის დამატება { try { db.Database.BeginTransaction(); Products product = new Products(); product.Name = name; product.Company = company; product.ImageUrl = image_url; db.Add(product); db.SaveChanges(); db.Database.CommitTransaction(); } catch (Exception ex) { db.Database.RollbackTransaction(); throw new Exception(ex.Message); } }
public void AddShopProduct(string shopid, string productname, string barcode, double price) //ამატებს ShopProduct ცხილში ჩანაწერს { try { db.Database.BeginTransaction(); ShopProducts shopproduct = new ShopProducts(); int productID = db.Products.FirstOrDefault(x => x.Name == productname).Id; shopproduct.ShopId = Convert.ToInt32(shopid); shopproduct.ProductId = productID; shopproduct.Barcode = barcode; shopproduct.Price = Convert.ToDecimal(price); db.Add(shopproduct); db.SaveChanges(); db.Database.CommitTransaction(); } catch (Exception ex) { db.Database.RollbackTransaction(); //throw new Exception(ex.Message); } }
public void Add(Frequency frequency) { _context.Frequencies.Add(frequency); _context.SaveChanges(); }