public void AddCategory(workoutcategory objcategory) { try { using (var objcontext = new WorkoutSPAEntities()) { objcontext.workoutcategories.Add(objcategory); objcontext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void EditCategory(workoutcategory item) { try { using (WorkoutSPAEntities objContext = new WorkoutSPAEntities()) { var objcategory = (from obj in objContext.workoutcategories where obj.categoryid == item.categoryid select obj).First(); objcategory.categoryname = item.categoryname; objContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }