Esempio n. 1
0
 public Product GetProduct(int id)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         return(onlineShoppingContext.products.Where(product => product.ProductId == id).FirstOrDefault());
     }
 }
Esempio n. 2
0
 public Category GetCategory(int id)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         return(onlineShoppingContext.Categories.Where(category => category.CategoryId == id).FirstOrDefault());
     }
 }
Esempio n. 3
0
 public Account Login(Account account)
 {
     using (OnlineShoppingContext context = new OnlineShoppingContext())
     {
         var result = context.Accounts.Where(value => value.EmailId == account.EmailId && value.Password == account.Password).FirstOrDefault();
         return(result);
     }
 }
Esempio n. 4
0
 public void AddUser(Account account)
 {
     using (OnlineShoppingContext context = new OnlineShoppingContext())
     {
         context.Accounts.Add(account);
         context.SaveChanges();
     }
 }
Esempio n. 5
0
 public List <Category> DropDownList()
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         List <Category> categories = onlineShoppingContext.Categories.ToList();
         return(categories);
     }
 }
Esempio n. 6
0
 public void Update(Product product)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         onlineShoppingContext.Entry(product).State = System.Data.Entity.EntityState.Modified;
         onlineShoppingContext.SaveChanges();
     }
 }
Esempio n. 7
0
 public void  AddProduct(Product product)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         onlineShoppingContext.products.Add(product);
         onlineShoppingContext.SaveChanges();
     }
 }
Esempio n. 8
0
 public Product Details(int id)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         Product product = onlineShoppingContext.products.Find(id);
         return(product);
     }
 }
Esempio n. 9
0
 public List <Product> ProductDetails()
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         List <Product> data = onlineShoppingContext.products.ToList();
         return(data);
     }
 }
Esempio n. 10
0
 public void Update(Category category)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         onlineShoppingContext.Entry(category).State = System.Data.Entity.EntityState.Modified;
         onlineShoppingContext.SaveChanges();
     }
 }
Esempio n. 11
0
 public Category Details(int id)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         Category category = onlineShoppingContext.Categories.Find(id);
         return(category);
     }
 }
Esempio n. 12
0
 public List <Category> CategoryDetails()
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         List <Category> data = onlineShoppingContext.Categories.ToList();
         return(data);
     }
 }
Esempio n. 13
0
 public void AddCategory(Category category)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         onlineShoppingContext.Categories.Add(category);
         onlineShoppingContext.SaveChanges();
     }
 }
Esempio n. 14
0
 public void Delete(int id)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         Product product = onlineShoppingContext.products.Find(id);
         onlineShoppingContext.products.Remove(product);
         onlineShoppingContext.SaveChanges();
     }
 }
Esempio n. 15
0
 public void Delete(int id)
 {
     using (OnlineShoppingContext onlineShoppingContext = new OnlineShoppingContext())
     {
         Category category = onlineShoppingContext.Categories.Find(id);
         onlineShoppingContext.Categories.Remove(category);
         onlineShoppingContext.SaveChanges();
     }
 }