예제 #1
0
        public List <workout_collection> ListAllCollection()
        {
            try
            {
                WorkoutspaEntities1 db = new WorkoutspaEntities1();

                return(db.workout_collection.ToList());
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
 public void AddCategory(workout_category item)
 {
     try
     {
         WorkoutspaEntities1 db = new WorkoutspaEntities1();
         db.workout_category.Add(item);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 public void AddCollection(workout_collection item)
 {
     try
     {
         WorkoutspaEntities1 db = new WorkoutspaEntities1();
         db.workout_collection.Add(item);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
        public List <workout_category> ListAllCategory()
        {
            try
            {
                WorkoutspaEntities1 db = new WorkoutspaEntities1();

                return(db.workout_category.ToList());
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
        public workout_category Get(int id)
        {
            workout_category objWork = null;

            try
            {
                WorkoutspaEntities1 db = new WorkoutspaEntities1();
                objWork = (from obj in db.workout_category
                           where obj.category_id == id
                           select obj).First();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(objWork);
        }
예제 #6
0
        public void EditCategory(workout_category item)
        {
            try
            {
                WorkoutspaEntities1 db = new WorkoutspaEntities1();
                var ObjCategory        = (from obj in db.workout_category
                                          where obj.category_id == item.category_id
                                          select obj).First();

                ObjCategory.category_name = item.category_name;

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
        public void DeleteCategory(int id)
        {
            Console.WriteLine("enter the category id to delete");
            int Id = int.Parse(Console.ReadLine());

            try
            {
                WorkoutspaEntities1 db = new WorkoutspaEntities1();
                var ObjCategory        = (from obj in db.workout_category
                                          where obj.category_id == Id
                                          select obj).First();
                db.workout_category.Remove(ObjCategory);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #8
0
        public void EditCollection(workout_collection item)
        {
            try
            {
                WorkoutspaEntities1 db = new WorkoutspaEntities1();
                var ObjCollection      = (from obj in db.workout_collection
                                          where obj.workout_id == item.workout_id
                                          select obj).First();

                ObjCollection.workout_title         = item.workout_title;
                ObjCollection.workout_note          = item.workout_note;
                ObjCollection.calories_burn_per_min = item.calories_burn_per_min;
                ObjCollection.category_id           = item.category_id;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }