/// <summary> /// Thêm comment /// </summary> /// <param name="com">Comment</param> /// <returns>long</returns> public long InsertComment(StudyOnline.Entities.Models.Comment com) { using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline()) { try { _db.Comment.Add(com); _db.SaveChanges(); return(com.ID); } catch (Exception) { return(-1); } } }
/// <summary> /// Sửa comment /// </summary> /// <param name="com">Comment</param> /// <returns>bool</returns> public bool UpdateComment(StudyOnline.Entities.Models.Comment com) { using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline()) { try { var co = _db.Comment.Find(com.ID); co.UserName = com.UserName; co.Content = com.Content; co.CreateDate = com.CreateDate; co.Avatar = com.Avatar; co.Status = com.Status; co.UserID = com.UserID; co.LessonID = com.LessonID; co.ParentID = com.ParentID; _db.SaveChanges(); return(true); } catch (Exception) { return(false); } } }
public bool UpdateComment(StudyOnline.Entities.Models.Comment com) { return(comentRepository.UpdateComment(com)); }
public long InsertComment(StudyOnline.Entities.Models.Comment com) { return(comentRepository.InsertComment(com)); }