예제 #1
0
 public Chocolate GetChocolate(string Name)
 {
     using (AccountContext accountContext = new AccountContext())
     {
         return(accountContext.Chocolate.Where(chocolate => chocolate.Name == Name).FirstOrDefault());
     }
 }
        public static AccountEntity ValidateUser(AccountEntity account)
        {
            AccountContext database = new AccountContext();
            AccountEntity  result   = database.Account.Where(user => user.Name == account.Name && user.Password == account.Password).FirstOrDefault();

            return(result);
        }
예제 #3
0
 public void UpdateCategories(Categories categories)
 {
     using (AccountContext db = new AccountContext())
     {
         db.Entry(categories).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
예제 #4
0
 public static List <Categories> DropDownList()
 {
     using (AccountContext accountContext = new AccountContext())
     {
         List <Categories> data = accountContext.Categories.ToList();
         return(data);
     }
 }
예제 #5
0
 public List <Categories> GetCategoriesDetails()
 {
     using (AccountContext accountContext = new AccountContext())
     {
         List <Categories> data = accountContext.Categories.ToList();
         return(data);
     }
 }
예제 #6
0
 public void AddCategories(Categories categorie)
 {
     using (AccountContext db = new AccountContext())
     {
         db.Categories.Add(categorie);
         db.SaveChanges();
     }
 }
 public static void Signup(AccountEntity accountentity)
 {
     using (AccountContext accountContext = new AccountContext())
     {
         accountContext.Account.Add(accountentity);
         accountContext.SaveChanges();
     }
 }
예제 #8
0
 public void UpdateChocolate(Chocolate chocolate)
 {
     using (AccountContext db = new AccountContext())
     {
         db.Entry(chocolate).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
예제 #9
0
 public List <Chocolate> GetChocolateDetails()
 {
     using (AccountContext accountContext = new AccountContext())
     {
         List <Chocolate> data = accountContext.Chocolate.ToList();
         return(data);
     }
 }
예제 #10
0
 public void AddChocolate(Chocolate chocolates)
 {
     using (AccountContext db = new AccountContext())
     {
         db.Chocolate.Add(chocolates);
         db.SaveChanges();
     }
 }
예제 #11
0
 public void DeleteCategories(int id)
 {
     using (AccountContext db = new AccountContext())
     {
         Categories categories = db.Categories.Find(id);
         db.Categories.Remove(categories);
         db.SaveChanges();
     }
 }
예제 #12
0
 public void DeleteChocolate(string Name)
 {
     using (AccountContext db = new AccountContext())
     {
         Chocolate chocolate = db.Chocolate.Find(Name);
         db.Chocolate.Remove(chocolate);
         db.SaveChanges();
     }
 }