Пример #1
0
 public async Task SaveData(HttpRequestBase request, HttpResponseBase response, Int64 userId)
 {
     if (request.HttpMethod != "POST")
     {
         return;
     }
     try
     {
         String json = null;
         using (var tr = new StreamReader(request.InputStream))
             json = tr.ReadToEnd();
         response.ContentType = "application/json";
         var    dataToSave = JsonConvert.DeserializeObject <ExpandoObject>(json, new ExpandoObjectConverter());
         String baseUrl    = dataToSave.Get <String>("baseUrl");
         if (baseUrl.StartsWith("/model/dialog/", StringComparison.OrdinalIgnoreCase))
         {
             baseUrl = baseUrl.Replace("/model/dialog/", "/_dialog/");
             dataToSave.Set("baseUrl", baseUrl);
         }
         response.ContentType = MimeTypes.Application.Json;
         await _baseController.SaveDataObj(prms => prms.Set("UserId", userId), dataToSave, response.Output);
     }
     catch (Exception ex)
     {
         _baseController.WriteExceptionStatus(ex, response);
     }
 }