Пример #1
0
 public bool ToRegisterProductCategory(ProductCategory productCategory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.productcategory.Add(productCategory);
         userDataBase.SaveChanges();
         return(true);
     }
 }
Пример #2
0
 public bool ToUpdateProductCategory(ProductCategory productCategory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(productCategory).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
Пример #3
0
 public bool ToRegisterProduct(Product product)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.product.Add(product);
         userDataBase.SaveChanges();
         return(true);
     }
 }
Пример #4
0
 public bool ToRegisterOrder(Orders order)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.orders.Add(order);
         userDataBase.SaveChanges();
         return(true);
     }
 }
Пример #5
0
 public bool ToUpdate(User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(user).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
Пример #6
0
 public bool ToRegister(User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.user.Add(user);
         userDataBase.SaveChanges();
         return(true);
     }
 }
Пример #7
0
 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);
     }
 }
Пример #8
0
 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);
     }
 }
Пример #9
0
 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);
     }
 }