示例#1
0
        /// <summary>
        /// Thêm video
        /// </summary>
        /// <param name="tq">Video</param>
        /// <returns>long</returns>
        public long InsertVideo(StudyOnline.Entities.Models.Video tq)
        {
            using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
            {
                try
                {
                    _db.Video.Add(tq);
                    _db.SaveChanges();

                    return(tq.ID);
                }
                catch (Exception)
                {
                    return(-1);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Cập nhật video
        /// </summary>
        /// <param name="v">Video</param>
        /// <returns>bool</returns>
        public bool UpdateVideo(StudyOnline.Entities.Models.Video v)
        {
            using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
            {
                try
                {
                    var c = _db.Video.Find(v.ID);
                    c.Name        = v.Name;
                    c.Link        = v.Link;
                    c.Length      = v.Length;
                    c.CreateDate  = v.CreateDate;
                    c.Description = v.Description;
                    c.Status      = v.Status;
                    c.LessonID    = v.LessonID;

                    _db.SaveChanges();
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }
示例#3
0
 public bool UpdateVideo(StudyOnline.Entities.Models.Video v)
 {
     return(videoRepository.UpdateVideo(v));
 }
示例#4
0
 public long InsertVideo(StudyOnline.Entities.Models.Video tq)
 {
     return(videoRepository.InsertVideo(tq));
 }