TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Calling Web Api to MVC Controller
Cj Felix
Sep 22
2014
Code
19.5
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Net.Http;
using
System.Runtime.Serialization.Json;
using
Newtonsoft.Json;
namespace
FRPI.WebApi.Helper
{
public
class
DeserializeData
{
readonly
string
webUrl =
"http://IpaddressOrDomainName/RootFolder/api/Controller/"
;
public
List<OrderDetails> GetInvoiveNo(
string
invoiceno) {
string
uri = webUrl + invoiceno;
using
(HttpClient httpClient =
new
HttpClient()) {
Task<String> response = httpClient.GetStringAsync(uri);
return
JsonConvert.DeserializeObjectAsync<List<OrderDetails>>(response.Result).Result;
}
}
}
}
Web Api
Controller in MVC
MVC