Exemple #1
0
        public string UpdateDetails(int id, Category obj)
        {
            CatageoryDbcon catageory = new CatageoryDbcon();
            var            gh        = catageory.Categories.Where(i => i.Id == id).FirstOrDefault();

            gh.CategoryName = obj.CategoryName;
            catageory.SaveChanges();
            return("Updated Sucessfully");
        }
Exemple #2
0
        public string DeleteDetails(int id)
        {
            CatageoryDbcon catageory = new CatageoryDbcon();
            var            gh        = catageory.Categories.Where(i => i.Id == id).FirstOrDefault();

            catageory.Categories.Remove(gh);
            catageory.SaveChanges();
            return("Deleted Sucessfully");
        }
Exemple #3
0
        public string AddCat()
        {
            CatageoryDbcon catageory = new CatageoryDbcon();
            Category       cat       = new Category();

            cat.CategoryName    = "Veg";
            cat.CategoryDetails = "Pure Veg";
            catageory.Categories.Add(cat);

            Category cat1 = new Category();

            cat1.CategoryName    = "Hot Drincks";
            cat1.CategoryDetails = "Tea";
            catageory.Categories.Add(cat1);

            Category cat2 = new Category();

            cat2.CategoryName    = "Non Veg";
            cat2.CategoryDetails = "Pure Non Veg";
            catageory.Categories.Add(cat2);

            Category cat3 = new Category();

            cat3.CategoryName    = "Main Course";
            cat3.CategoryDetails = "Biriyani";
            catageory.Categories.Add(cat3);

            Category cat4 = new Category();

            cat4.CategoryName    = "Cool Drincks";
            cat4.CategoryDetails = "Pepsi,Mountain Due";
            catageory.Categories.Add(cat4);

            catageory.SaveChanges();
            return("Added");
        }
Exemple #4
0
        public List <Category> GetId(int id)
        {
            CatageoryDbcon catageory = new CatageoryDbcon();

            return(catageory.Categories.Where(i => i.Id == id).ToList());
        }
Exemple #5
0
        public List <Category> GetDetailsI()
        {
            CatageoryDbcon catageory = new CatageoryDbcon();

            return(catageory.Categories.ToList());
        }