* Web.csproj:
* Profile.aspx: * MyProfile.aspx: * AccountController.cs: renamed the Profile method to "MyProfile", could avoid issue at migrating to MVC5 * favicon.png: favicon now displays a ~"Yavsc" * BlogManager.cs: * BlogsApiController.cs: The authorisation for removing a post is now implemented at Manager's side * BlogsController.cs: Removes this odd call to a static method from the Api controller * CalendarApi.cs: * GoogleController.cs: no more json output for the calls to the Google Api * WorkFlowController.cs: sorted using clauses * Basket.cs: * Commande.cs: * EstimToPdfFormatter.cs: * Brand.cs: adds xml doc * RssFeedsFormatter.cs: modifies xml doc * TexToPdfFormatter.cs: refactoring * Global.asax.cs: Document formatting * BBCodeHelper.cs: encapsulates the url display from the BBCode in starting and closing characters : "<>" * OAuth2.cs: * SimpleJsonPostMethod.cs: using System.Runtime.Serialization.Json instead of Newtonsof.Json * App.master: updating the favicon * RegistrationPending.aspx: fixes the returnUrl usage * AssemblyInfo.aspx: better explanation for this list * Web.config: tried to migrate to MVC5 (using NuGets) * Estim.cs: * ChangePasswordModel.cs: adds xmldoc * BasketController.cs: * BlogProvidersConfigurationSection.cs: cosmetic change * GoogleErrorMessage.cs: - adds xml docs - renders ctor from JsonReaderException obsolete * MvcActionValueBinder.cs: not used * web.config: no more used, gave it up to migrate to MVC5
This commit is contained in:
parent
a342b744df
commit
e676d2fdbf
31 changed files with 246 additions and 234 deletions
|
|
@ -22,7 +22,7 @@ using System;
|
|||
using System.Net;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization.Json;
|
||||
|
||||
namespace Yavsc.Helpers
|
||||
{
|
||||
|
|
@ -74,23 +74,18 @@ namespace Yavsc.Helpers
|
|||
/// <param name="query">Query.</param>
|
||||
public TAnswer Invoke(TQuery query)
|
||||
{
|
||||
Byte[] bytes = System.Text.Encoding.UTF8.GetBytes (
|
||||
JsonConvert.SerializeObject(query));
|
||||
Request.ContentLength = bytes.Length;
|
||||
|
||||
using (Stream dataStream = Request.GetRequestStream ()) {
|
||||
dataStream.Write (bytes, 0, bytes.Length);
|
||||
dataStream.Close ();
|
||||
DataContractJsonSerializer serquery = new DataContractJsonSerializer (typeof(TQuery));
|
||||
DataContractJsonSerializer seransw = new DataContractJsonSerializer (typeof(TAnswer));
|
||||
|
||||
using (MemoryStream streamQuery = new MemoryStream ()) {
|
||||
serquery.WriteObject (streamQuery, query);
|
||||
}
|
||||
|
||||
TAnswer ans = default (TAnswer);
|
||||
using (WebResponse response = Request.GetResponse ()) {
|
||||
using (Stream responseStream = response.GetResponseStream ()) {
|
||||
using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8)) {
|
||||
string responseStr = readStream.ReadToEnd ();
|
||||
ans = JsonConvert.DeserializeObject<TAnswer> (responseStr);
|
||||
readStream.Close ();
|
||||
}
|
||||
responseStream.Close ();
|
||||
ans = (TAnswer) seransw.ReadObject(responseStream);
|
||||
}
|
||||
response.Close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue