public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var id = context.Request.QueryString["id"]; var mockService = new AdvertismentAreaServiceMock(); JavaScriptSerializer serializer = new JavaScriptSerializer(); string d = serializer.Serialize(mockService.Get(Guid.Parse(id))); context.Response.Write(d); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); string jsonString = String.Empty; HttpContext.Current.Request.InputStream.Position = 0; using (StreamReader inputStream = new StreamReader(HttpContext.Current.Request.InputStream)) { jsonString = inputStream.ReadToEnd(); } var upload = jsonSerializer.Deserialize<AdvertismentAreaContext>(jsonString); //string resp = "ok"; //HttpContext.Current.Response.ContentType = "application/json"; // HttpContext.Current.Response.ContentEncoding = Encoding.UTF8; // HttpContext.Current.Response.Write(jsonSerializer.Serialize(resp)); //string s = ContextHelper.SaveAdvertismentAreaToXml(upload); //string path = "/Helper/PathCurrent/"; //var xmlCurrent = context.Server.MapPath(path); //XmlDocument xdoc = new XmlDocument(); //xdoc.LoadXml(s); //xdoc.Save(xmlCurrent+"/"+upload.IssueId.ToString() + ".xml"); IAdvertismentAreaService mockService = new AdvertismentAreaServiceMock(); string currentUpdate = Guardian.Advertisment.ContextHelper.TitleDateUpload(upload.ModifiedOn); upload.ModifiedTitle = currentUpdate; mockService.Set(upload); JavaScriptSerializer serializer = new JavaScriptSerializer(); var d = serializer.Serialize(currentUpdate); context.Response.Write(d); // HttpContext.Current.Response.Status = "200"; // context.Response.Write("File Save"); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); string jsonString = String.Empty; HttpContext.Current.Request.InputStream.Position = 0; using (StreamReader inputStream = new StreamReader(HttpContext.Current.Request.InputStream)) { jsonString = inputStream.ReadToEnd(); } var upload = jsonSerializer.Deserialize<AdvertismentAreaContext>(jsonString); IAdvertismentAreaService mockService = new AdvertismentAreaServiceMock(); string currentUpdate = Guardian.Advertisment.ContextHelper.TitleDateUpload(upload.ModifiedOn); upload.ModifiedTitle = currentUpdate; mockService.Set(upload); context.Response.StatusCode = 200; JavaScriptSerializer serializer = new JavaScriptSerializer(); var d = serializer.Serialize(currentUpdate); context.Response.Write(d); }