public List <Product> ProductView()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.product.ToList());
     }
 }
 public List <ProductCategory> ProductCategoryView()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.productcategory.ToList());
     }
 }
示例#3
0
 public object ToSearchCustomer(string UserName)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.user.Where(model => model.Email == UserName).FirstOrDefault());
     }
 }
示例#4
0
 public object ToDisplay(int UserId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.user.Where(model => model.UserId == UserId).FirstOrDefault());
     }
 }
 public object ToDisplayProductCategory(int CategoryId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.productcategory.Where(model => model.CategoryId == CategoryId).FirstOrDefault());
     }
 }
示例#6
0
 public List <User> CustomerView()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.user.ToList());
     }
 }
 public object ToDisplayProduct(int ProductId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.product.Where(model => model.ProductId == ProductId).FirstOrDefault());
     }
 }
示例#8
0
 public List <Orders> OrdersView()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.orders.ToList());
     }
 }
 public bool ToRegisterProduct(Product product)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.product.Add(product);
         userDataBase.SaveChanges();
         return(true);
     }
 }
示例#10
0
 public bool ToRegisterOrder(Orders order)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.orders.Add(order);
         userDataBase.SaveChanges();
         return(true);
     }
 }
示例#11
0
 public bool ToUpdate(User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(user).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
示例#12
0
 public bool ToRegister(User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.user.Add(user);
         userDataBase.SaveChanges();
         return(true);
     }
 }
示例#13
0
 public bool ToUpdateProductCategory(ProductCategory productCategory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(productCategory).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
示例#14
0
 public bool ToRegisterProductCategory(ProductCategory productCategory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.productcategory.Add(productCategory);
         userDataBase.SaveChanges();
         return(true);
     }
 }
示例#15
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);
     }
 }
示例#16
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);
     }
 }
示例#17
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);
     }
 }
示例#18
0
 public User CheckLogin(User user)
 {
     using (UserDataBase userContext = new UserDataBase())
     {
         var userdata = (from a in userContext.user where a.Email == user.Email || a.Email == user.Email select a).FirstOrDefault();
         var hashcode = userdata.HashCode;
         var encodingPasswordString = Helper.EncodePassword(user.Password, hashcode);
         var obj = userContext.user.Where(a => a.Email == user.Email && a.Password.Equals(encodingPasswordString)).FirstOrDefault();
         return(obj);
     }
 }