public HttpResponseMessage Post([FromBody] AnnouncementModel model)
        {
            var createAnnouncementAction = new CreateAnnouncement(model.ToEntity());
            var result = PerformAction <CreateAnnouncement, Announcement>(createAnnouncementAction);

            return(Request.CreateResponse(result.ValidationResult.GetStatusCode(HttpStatusCode.Created),
                                          new ActionReponse <AnnouncementConfirmationModel>(new AnnouncementConfirmationModel(createAnnouncementAction.NumberOfUsersEmailed), result.ValidationResult)));
        }
        /// <summary>
        /// 申请通告
        /// </summary>
        /// <param name="AnnoucementModel">通告信息</param>
        /// <returns></returns>
        public AnnouncementModel AddAnnouncement(AnnouncementModel model)
        {
            using (var dbContext = new MissionskyOAEntities())
            {
                //构建通知消息
                var notificationModel = new NotificationModel()
                {
                    //MessageType = NotificationType.PushMessage,
                    MessageType    = NotificationType.Email,
                    CreatedUserId  = model.CreateUserId,
                    Scope          = NotificationScope.Public,
                    Title          = model.Title,
                    MessageContent = model.Content,
                    BusinessType   = BusinessType.AdministrationEventAnnounce
                };

                if (model.Type == AnnouncementType.AssetInventory)
                {
                    //资产盘点发通知后需要创建新的盘点任务
                    int inventoryId = this._assetInventoryService.AddAssetInventory(new AssetInventoryModel()
                    {
                        Title       = model.Title,
                        Description = model.Content,
                        Status      = AssetInventoryStatus.Open
                    });
                    model.RefAssetInventoryId      = inventoryId;
                    notificationModel.BusinessType = BusinessType.AssetInventory;
                    // 消息通知
                    this._notificationService.Add(notificationModel, Global.IsProduction);
                }
                else
                {
                    if (model.Status == AnnouncementStatus.AllowPublish)
                    {
                        // 消息通知
                        this._notificationService.Add(notificationModel, Global.IsProduction);
                    }
                }

                var entity = dbContext.Announcements.Add(model.ToEntity());
                dbContext.SaveChanges();
                return(entity.ToModel());
            }
        }