Esempio n. 1
0
 //Cập nhật khóa học
 /// <summary>
 /// Cập Nhật Khóa Học
 /// </summary>
 /// <param name="course">Course</param>
 /// <returns>bool</returns>
 public bool editCourse(StudyOnline.Entities.Models.Course course)
 {
     using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
     {
         try
         {
             var c = _db.Course.Find(course.ID);
             c.CourseName       = course.CourseName;
             c.Avatar           = course.Avatar;
             c.VideoIntroduce   = course.VideoIntroduce;
             c.Description      = course.Description;
             c.Content          = course.Content;
             c.PriceSale        = course.PriceSale;
             c.Price            = course.Price;
             c.ViewCount        = course.ViewCount;
             c.CreateDate       = course.CreateDate;
             c.Tags             = course.Tags;
             c.Status           = course.Status;
             c.TopHot           = course.TopHot;
             c.MetaTitle        = course.MetaTitle;
             c.CourseCategoryID = course.CourseCategoryID;
             _db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Tạo 1 khóa học
 /// </summary>
 /// <param name="course">Course</param>
 /// <returns>long</returns>
 public long addCourse(StudyOnline.Entities.Models.Course course)
 {
     using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
     {
         try
         {
             _db.Course.Add(course);
             _db.SaveChanges();
             return(course.ID);
         }
         catch (Exception)
         {
             return(-1);
         }
     }
 }