public bool RemoveOrder(int orderId) { using (FireBase_VS_MSSQLEntities3 entities = new FireBase_VS_MSSQLEntities3()) { bool has = entities.Order.Any(o => o.Id == orderId); if (has == true) { entities.Order.Remove(entities.Order.Where(o => o.Id == orderId).FirstOrDefault()); entities.SaveChanges(); return(true); } else { return(false); } } }
public bool RemoveCustomer(int customerId) { using (FireBase_VS_MSSQLEntities3 entities = new FireBase_VS_MSSQLEntities3()) { bool has = entities.Customer.Any(cus => cus.Id == customerId); if (has == true) { entities.Customer.Remove(entities.Customer.Where(c => c.Id == customerId).FirstOrDefault()); entities.SaveChanges(); return(true); } else { return(false); } } }
public bool UpdateOrder(Order order) { using (FireBase_VS_MSSQLEntities3 entities = new FireBase_VS_MSSQLEntities3()) { bool has = entities.Order.Any(o => o.Id == order.Id); if (has == true) { entities.Order.Take(1).FirstOrDefault().Customer_Id = order.Customer_Id; entities.Order.Take(1).FirstOrDefault().Date = order.Date; entities.Order.Take(1).FirstOrDefault().Price = order.Price; entities.SaveChanges(); return(true); } else { return(false); } } }
public bool UpdateCustomer(Customer customer) { using (FireBase_VS_MSSQLEntities3 entities = new FireBase_VS_MSSQLEntities3()) { bool has = entities.Customer.Any(c => c.Id == customer.Id); if (has == true) { entities.Customer.Take(1).FirstOrDefault().Name = $"{customer.Name}"; entities.Customer.Take(1).FirstOrDefault().Country = $"{customer.Country}"; entities.Customer.Take(1).FirstOrDefault().Age = customer.Age; entities.SaveChanges(); return(true); } else { return(false); } } }
public bool AddCustomer(Customer customer) { using (FireBase_VS_MSSQLEntities3 entities = new FireBase_VS_MSSQLEntities3()) { bool has = entities.Customer.Any(cus => cus.Id == customer.Id); if (has == false) { entities.Customer.Add(new Customer { Id = customer.Id, Name = customer.Name, Country = customer.Country, Age = customer.Age }); entities.SaveChanges(); return(true); } else { return(false); } } }
public bool AddOrder(Order order) { using (FireBase_VS_MSSQLEntities3 entities = new FireBase_VS_MSSQLEntities3()) { bool has = entities.Order.Any(ord => ord.Id == order.Id); if (has == false) { entities.Order.Add(new Order { Id = order.Id, Customer_Id = order.Customer_Id, Price = order.Price, Date = order.Date }); entities.SaveChanges(); return(true); } else { return(false); } } }