/// <summary> /// Tạo 1 loại khóa học /// </summary> /// <param name="course">CourseCategory</param> /// <returns>long</returns> public long CreateCourseCategory(StudyOnline.Entities.Models.CourseCategory course) { using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline()) { try { _db.CourseCategory.Add(course); _db.SaveChanges(); return(course.ID); } catch (Exception) { return(-1); } } }
/// <summary> /// Cập nhật 1 loại khóa học /// </summary> /// <param name="course">CourseCategory</param> /// <returns>bool</returns> public bool UpdateCourseCategory(StudyOnline.Entities.Models.CourseCategory course) { using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline()) { try { var c = _db.CourseCategory.Find(course.ID); c.Name = course.Name; c.Descrpition = course.Descrpition; c.ParentID = course.ParentID; c.Link = course.Link; c.Tags = course.Tags; c.MetaTittle = course.MetaTittle; c.CreateDate = course.CreateDate; c.Status = course.Status; _db.SaveChanges(); return(true); } catch (Exception) { return(false); } } }
public bool UpdateCourseCategory(StudyOnline.Entities.Models.CourseCategory course) { return(courseCategory.UpdateCourseCategory(course)); }
public long CreateCourseCategory(StudyOnline.Entities.Models.CourseCategory course) { return(courseCategory.CreateCourseCategory(course)); }