public int SaveOrder(Order order) { using (var context = new GPSContext()) { context.Orders.Add(order); return(context.SaveChanges()); } }
public void UpdateCategory(Category category) { using (var context = new GPSContext()) { context.Entry(category).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void Update(TEntity obj) { using (var ctx = new GPSContext()) { ctx.Entry(obj).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }
public void SaveCategory(Category category) { using (var context = new GPSContext()) { context.Categories.Add(category); context.SaveChanges(); } }
public void UpdateProduct(Product Product) { using (var context = new GPSContext()) { context.Entry(Product).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void Add(TEntity obj) { using (var ctx = new GPSContext()) { ctx.Set <TEntity>().Add(obj); ctx.SaveChanges(); } }
public void AddRange(IEnumerable <Empresa> empresas) { using (var ctx = new GPSContext()) { ctx.Empresas.AddRange(empresas); ctx.SaveChanges(); } }
public void SaveProduct(Product Product) { using (var context = new GPSContext()) { context.Entry(Product.Category).State = System.Data.Entity.EntityState.Unchanged; context.Products.Add(Product); context.SaveChanges(); } }
public Circle InsertCirlce(Circle circle) { try { _context.Circle.Add(circle); _context.SaveChanges(); return(circle); } catch (SqlException ex) { _logger.LogWarning("InsertCirlce method couldn't work, because of DB connection error: {ErrorMessage}", ex.Message); } catch (Exception ex) { _logger.LogWarning("InsertCirlce method couldn't work, because of this error: {ErrorMessage}", ex.Message); } return(null); }
public void DeleteProduct(int ID) { using (var context = new GPSContext()) { var Product = context.Products.Find(ID); //context.Entry(category).State = System.Data.Entity.EntityState.Deleted; context.Products.Remove(Product); context.SaveChanges(); } }
public void DeleteCategory(int ID) { using (var context = new GPSContext()) { var category = context.Categories.Where(x => x.ID == ID).Include(x => x.Products).FirstOrDefault(); //context.Entry(category).State = System.Data.Entity.EntityState.Deleted; context.Products.RemoveRange(category.Products); context.Categories.Remove(category); context.SaveChanges(); } }
public bool UpdateOrderStatus(int ID, string status) { using (var context = new GPSContext()) { var order = context.Orders.Find(ID); order.Status = status; context.Entry(order).State = EntityState.Modified; return(context.SaveChanges() > 0); } }
public void Add(Trace entity) { _context.Traces.Add(entity); _context.SaveChanges(); }
public void Add(Payment entity) { _context.Payments.Add(entity); _context.SaveChanges(); }
public void Add(Client entity) { _context.Clients.Add(entity); _context.SaveChanges(); }