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()); } }
public object ToSearchCustomer(string UserName) { using (UserDataBase userDataBase = new UserDataBase()) { return(userDataBase.user.Where(model => model.Email == UserName).FirstOrDefault()); } }
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()); } }
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()); } }
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); } }
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 ToUpdateProductCategory(ProductCategory productCategory) { using (UserDataBase userDataBase = new UserDataBase()) { userDataBase.Entry(productCategory).State = EntityState.Modified; userDataBase.SaveChanges(); return(true); } }
public bool ToRegisterProductCategory(ProductCategory productCategory) { using (UserDataBase userDataBase = new UserDataBase()) { userDataBase.productcategory.Add(productCategory); 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); } }
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 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); } }