I am trying task using WCFDataServices.
I have a Service operation Like
[WebInvoke(Method=”POST”)]
Public bool Add(string x1, string x2, string x3)
{
// ADDS a NEW RECORD TO DB. AND IF THE ADDITION IS SUCCESSFULL RETURs true or false
}
In my MVC Client Application. In the repository I have Function to Add Like
public bool Add(string y1, string y2, string y3)
{
// HERE I WANT to EXECUTE THE URI AND CAPUTURE THE RETURNED VALUE. AND PASS IT TO MY CONTROLLER TO SHOW SOME ACTION IN THE VIEW.
}
I dont have any problem in the service. It returns the boolean value as expected.
I couldnt figure out how i can capture the returned boolean value in my Repository Method.
// OperationResponse x = dsContext.Execute(requestUri, Microsoft.Data.OData.HttpMethod.Post);
I tried to do something like above line.But didnt work.
Thanks For Your Time
I assume you’re using WCF Data Services 5.0 on the client (since you’re using the Execute with a method). Please upgrade to the RTM bits (http://blogs.msdn.com/b/astoriateam/archive/2012/04/09/wcf-data-services-5-0-rtm-release.aspx), which are also available on NuGet (search for Microsoft.Data.Services.Client). After that this code should work just fine: