public bool ToRegisterProductCategory(ProductCategory productCategory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.productcategory.Add(productCategory);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToUpdateProductCategory(ProductCategory productCategory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(productCategory).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToRegisterProduct(Product product)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.product.Add(product);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToRegisterOrder(Orders order)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.orders.Add(order);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToUpdate(User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(user).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToRegister(User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.user.Add(user);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToDeleteProduct(int ProductId, Product product)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         product = userDataBase.product.Where(model => model.ProductId == ProductId).FirstOrDefault();
         userDataBase.product.Remove(product);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToDeleteProductCategory(int CategoryId, ProductCategory productCategory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         productCategory = userDataBase.productcategory.Where(model => model.CategoryId == CategoryId).FirstOrDefault();
         userDataBase.productcategory.Remove(productCategory);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToDelete(int UserId, User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         user = userDataBase.user.Where(model => model.UserId == UserId).FirstOrDefault();
         userDataBase.user.Remove(user);
         userDataBase.SaveChanges();
         return(true);
     }
 }