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)); } }
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); }