Example #1
0
 public object ToDisplayCarousel(int UserId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.carouselSliders.Where(model => model.ID == UserId).FirstOrDefault());
     }
 }
 public List <ProductCategory> ViewProductCategory()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.productCategory.ToList());
     }
 }
 public Inventory ToDisplayProduct(int ProductId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.inventory.Where(model => model.ProductId == ProductId).FirstOrDefault());
     }
 }
Example #4
0
 public List <City> CityList()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.city.ToList());
     }
 }
 public List <Inventory> ViewProduct()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.inventory.ToList());
     }
 }
Example #6
0
 public List <State> StateList()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.state.ToList());
     }
 }
 public object ToDisplayProductCategory(int CategoryId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.productCategory.Where(model => model.CategoryId == CategoryId).FirstOrDefault());
     }
 }
Example #8
0
 public object ToDisplay(int UserId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.user.Where(model => model.UserId == UserId).FirstOrDefault());
     }
 }
Example #9
0
 public List <User> CustomerView()
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.user.ToList());
     }
 }
Example #10
0
 public object ToDisplayCustomer(string UserId)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         return(userDataBase.user.Where(model => model.UserName == UserId).FirstOrDefault());
     }
 }
Example #11
0
 public bool ToUpdateCarousel(CarouselSlider carouselSlider)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(carouselSlider).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
Example #12
0
 public bool ToRegister(User user)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.user.Add(user);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToUpdateProductCategory(ProductCategory inventory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.Entry(inventory).State = EntityState.Modified;
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToRegisterProductCategory(ProductCategory inventory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         userDataBase.productCategory.Add(inventory);
         userDataBase.SaveChanges();
         return(true);
     }
 }
 public bool ToDeleteProductCategory(int CategoryId, ProductCategory inventory)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         inventory = userDataBase.productCategory.Where(model => model.CategoryId == CategoryId).FirstOrDefault();
         userDataBase.productCategory.Remove(inventory);
         userDataBase.SaveChanges();
         return(true);
     }
 }
Example #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);
     }
 }
Example #17
0
 public bool ToDeleteCarousel(int UserId, CarouselSlider carouselSlider)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         SqlParameter id   = new SqlParameter("@ID", UserId);
         var          data = userDataBase.Database.ExecuteSqlCommand("CarouselSlider_Delete @ID", id);
         //carouselSlider = userDataBase.carouselSliders.Where(model => model.ID == UserId).FirstOrDefault();
         //userDataBase.carouselSliders.Remove(carouselSlider);
         //userDataBase.SaveChanges();
         return(true);
     }
 }
Example #18
0
 public bool ToAdd(CarouselSlider carouselSlider)
 {
     using (UserDataBase userDataBase = new UserDataBase())
     {
         SqlParameter filename = new SqlParameter("@FileName", carouselSlider.FileName);
         SqlParameter filesize = new SqlParameter("@FileSize", carouselSlider.FileSize);
         SqlParameter filepath = new SqlParameter("@FilePath", carouselSlider.FilePath);
         var          data     = userDataBase.Database.ExecuteSqlCommand(" CarouselSlider_Insert @FileName,@FileSize,@FilePath", filename, filesize, filepath);
         //userDataBase.carouselSliders.Add(carouselSlider);
         //userDataBase.SaveChanges();
         return(true);
     }
 }
Example #19
0
 public string CheckLogin(string username, string password)
 {
     using (UserDataBase userContext = new UserDataBase())
     {
         var obj = userContext.user.Where(a => a.UserName.Equals(username) && a.Password.Equals(password)).FirstOrDefault();
         if (obj != null)
         {
             return(obj.UserName);
         }
         else
         {
             return(null);
         }
     }
 }