Ejemplo n.º 1
0
        private void SetContent(HttpContext context)
        {
            HttpCookie cookie = req.Cookies["client"];

            if (cookie != null)
            {
                int clientID          = int.Parse(cookie.Value);
                NameValueCollection p = context.Request.Params;
                string ID             = p["ID"];
                string PageID         = p["PageID"];
                if (!string.IsNullOrEmpty(PageID))
                {
                    Data.POCOS.Content content;
                    if (!string.IsNullOrEmpty(ID) && ID != "0")
                    {
                        content = Data.POCOS.Content.Single(int.Parse(ID));
                    }
                    else
                    {
                        content = new Data.POCOS.Content();
                    }
                    content.Title    = p["Title"];
                    content.Text     = p["Text"];
                    content.PageID   = int.Parse(PageID);
                    content.Locked   = !string.IsNullOrEmpty(p["Locked"]);
                    content.ClientID = clientID;
                    if (context.Request.Files.Count > 0)
                    {
                        HttpPostedFile file = context.Request.Files["ImageUrl"];
                        if (file.ContentLength > 0)
                        {
                            string filename = file.FileName;
                            string filepath = Common.ImagesPath + filename;
                            file.SaveAs(filepath);
                            content.ImageUrl = filename;
                        }
                    }
                    content.Save();
                }
            }
            context.Response.WriteJsonSuccess();
        }
Ejemplo n.º 2
0
 private void SetContent(HttpContext context)
 {
     HttpCookie cookie = req.Cookies["client"];
     if (cookie != null)
     {
         int clientID = int.Parse(cookie.Value);
         NameValueCollection p = context.Request.Params;
         string ID = p["ID"];
         string PageID = p["PageID"];
         if (!string.IsNullOrEmpty(PageID))
         {
             Data.POCOS.Content content;
             if (!string.IsNullOrEmpty(ID) && ID != "0")
                 content = Data.POCOS.Content.Single(int.Parse(ID));
             else
                 content = new Data.POCOS.Content();
             content.Title = p["Title"];
             content.Text = p["Text"];
             content.PageID = int.Parse(PageID);
             content.Locked = !string.IsNullOrEmpty(p["Locked"]);
             content.ClientID = clientID;
             if (context.Request.Files.Count > 0)
             {
                 HttpPostedFile file = context.Request.Files["ImageUrl"];
                 if (file.ContentLength > 0)
                 {
                     string filename = file.FileName;
                     string filepath = Common.ImagesPath + filename;
                     file.SaveAs(filepath);
                     content.ImageUrl = filename;
                 }
             }
             content.Save();
         }
     }
     context.Response.WriteJsonSuccess();
 }