/// <summary> /// 删除公告 /// </summary> /// <param name="announcementId">公告Id</param> public void Delete(long announcementId) { Announcement announcement = Get(announcementId); announcementRepository.Delete(announcement); }
/// <summary> /// 更新公告 /// </summary> /// <param name="announcement">公告实体</param> public void Update(Announcement announcement) { announcement.LastModified = DateTime.UtcNow; announcementRepository.Update(announcement); }
/// <summary> /// 创建公告 /// </summary> /// <param name="announcement">公告实体</param> public void Create(Announcement announcement) { announcementRepository.Insert(announcement); announcement.DisplayOrder = announcement.Id; announcementRepository.Update(announcement); }
/// <summary> /// 新建实体时使用 /// </summary> public static Announcement New() { Announcement announcement = new Announcement() { Subject = string.Empty, SubjectStyle = string.Empty, Body = string.Empty, HyperLinkUrl = string.Empty, ReleaseDate = DateTime.UtcNow, ExpiredDate = DateTime.UtcNow, LastModified = DateTime.UtcNow, CreatDate = DateTime.UtcNow.ToLocalTime() }; return announcement; }