示例#1
0
        public IHttpActionResult Add()
        {
            try
            {
                var request = Context.GetCurrentRequest();
                var siteId  = request.GetPostInt("siteId");
                if (!request.IsAdminLoggin ||
                    !request.AdminPermissions.HasSitePermissions(siteId, FormUtils.PluginId))
                {
                    return(Unauthorized());
                }

                var formInfo = new FormInfo
                {
                    SiteId      = siteId,
                    AddDate     = DateTime.Now,
                    Title       = request.GetPostString("title"),
                    Description = request.GetPostString("description")
                };

                FormDao.Insert(formInfo);

                return(Ok(new
                {
                    Value = FormManager.GetFormInfoList(siteId, 0)
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#2
0
        private void Service_ContentTranslateCompleted(object sender, ContentTranslateEventArgs e)
        {
            var formInfo = FormDao.GetFormInfoOrCreateIfNotExists(e.SiteId, e.ChannelId, e.ContentId);

            formInfo.SiteId      = e.TargetSiteId;
            formInfo.ChannelId   = e.TargetChannelId;
            formInfo.ContentId   = e.TargetContentId;
            formInfo.IsTimeout   = false;
            formInfo.TimeToStart = DateTime.Now;
            formInfo.TimeToEnd   = formInfo.TimeToStart.AddMonths(3);
            FormDao.Insert(formInfo);
        }