473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Is it possible to use return type bool in WEB API post method?

Hi,

I sew lot of sample for ASP WEB API. In althose link the post method is using

HttpResponseMessage as return tyope

can any one tell me Is it possible to use return type bool in WEB API post method?

Any one Please send any sample on this that will helps me.
Oct 3 '12 #1
1 6711
HttpResponseMessage represents the http response that is returned to the client. You cannot just return bool it has to be a valid http message. Is the bool just to indicate success or failure? You could set the status code on the HttpResponseMessage to like 200 for success and 500 or something for failure.

If you need to return something more complex to the client you can set the content of the httpresponsemessage to something, like some json, xml, etc
Oct 25 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jarmo Muukka | last post by:
Hello, I have an interface which has a method which returns an interface. I would like to return a real type in implemented class. interface IFoo { .... }
9
by: Ann Huxtable | last post by:
I have the following code segment - which compiles fine. I'm just worried I may get run time probs - because it looks like the functions are being overloaded by the return types?. Is this Ok: ? ...
1
by: Steven.Xu | last post by:
Hi every one. I have two class: MyBase and MySon. MyBase is the base class of MySon. On the other hand I have two interface: MyBaseItef and MySonItef. MyBaseItef is the base interface of...
5
by: Gernold Schneider | last post by:
I have a managed code function calling a unmanaged code function which returns a "bool". Obviously the return value is always "true", if i am not running the code in the debugger. If i run the...
10
by: geoffblanduk_nospam | last post by:
Just curious, we no longer require void on a method that takes no parameters; void methodWithNoParameters(void) has been replaced by void methodWithNoParameters(). Is there a good reason we...
59
by: Michael C | last post by:
eg void DoIt() { int i = FromString("1"); double d = FromString("1.1"); } int FromString(string SomeValue) {
2
by: mhs1pk | last post by:
Hi, I m a having problem while trying to make the return type of a method in MFC appl in VC6 as complex<double>. If i declear a variable wth std::complex<double> type, it is compled successfully....
4
by: prasannashetye | last post by:
hello I want to return more than 1 values from my web method. For this I am planing to create a class which will have number of properties, will set properties and return object of that class in...
6
by: Andrus | last post by:
I need to create method which returns my application object type as string : TypeName(typeof( List<int>)) should return "List<int>" or "System.Collections.Generic.List<int>" ...
2
by: Ajit Bhoravkar | last post by:
As a method returns a int value we have return type as a int and if method returns nothing we use return type as a void. If the method is not returning anything then why should we use void. I know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.