示例#1
0
 public void AddCatagory(workout_categorys obj)
 {
     try
     {
         workouttrackerprojectsEntities db = new workouttrackerprojectsEntities();
         db.workout_categorys.Add(obj);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
        public List <workout_categorys> GetAll()
        {
            try
            {
                using (workouttrackerprojectsEntities objcontext = new workouttrackerprojectsEntities())
                {
                    var query = from obj in objcontext.workout_categorys
                                select obj;

                    return(query.ToList());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public workout_categorys GetById(int catagoryid)
        {
            try
            {
                using (workouttrackerprojectsEntities objcontext = new workouttrackerprojectsEntities())
                {
                    var query = (from obj in objcontext.workout_categorys
                                 where obj.category_id == catagoryid
                                 select obj).FirstOrDefault();

                    return(query);
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }