//adding category public void AddCategory(workout_category item) { try { CasestudyEntities db = new CasestudyEntities(); db.workout_category.Add(item); db.SaveChanges(); } catch (Exception ex) { throw ex; } }
public workout_category Get(int id) { workout_category objWork = null; try { WorkoutAppEntities db = new WorkoutAppEntities(); objWork = (from obj in db.workout_category where obj.category_id == id select obj).First(); } catch (Exception ex) { throw ex; } return(objWork); }
public void EditCategory(workout_category item) { try { WorkoutAppEntities db = new WorkoutAppEntities(); 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; } }