/// <summary> /// Thêm tài liệu /// </summary> /// <param name="am">AttachMent</param> /// <returns>long</returns> public long InsertAttachMent(StudyOnline.Entities.Models.AttachMent am) { using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline()) { try { _db.AttachMent.Add(am); _db.SaveChanges(); return(am.ID); } catch (Exception) { return(-1); } } }
/// <summary> /// Sửa tài liệu /// </summary> /// <param name="am">AttachMent</param> /// <returns>bool</returns> public bool UpdateAttachMent(StudyOnline.Entities.Models.AttachMent am) { using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline()) { try { var a = _db.AttachMent.Find(am.ID); a.FileName = am.FileName; a.Path = am.Path; a.Type = am.Type; a.CreateDate = am.CreateDate; a.Status = am.Status; a.LessonID = am.LessonID; _db.SaveChanges(); return(true); } catch (Exception) { return(false); } } }
public bool UpdateAttachMent(StudyOnline.Entities.Models.AttachMent am) { return(attachmentRepository.UpdateAttachMent(am)); }
public long InsertAttachMent(StudyOnline.Entities.Models.AttachMent am) { return(attachmentRepository.InsertAttachMent(am)); }