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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sandeep kumar
NA
58
4.5k
How to return datatable data in array jason form in web Ap
May 29 2021 6:01 AM
I NEED IN THIS FORM OF DATA.Please help me
data: [
["10/05/2021", 5, 6,6],
["11/05/2021", 8, 9,4],
["12/05/2021", 4, 6,2],
["13/05/2021", 6, 5,6],
["14/05/2021", 4, 3,3],
["15/05/2021", 7, 7,4],
["16/05/2021", 8, 6,1],
],
Controller Part Code
//http://localhost:58231/api/ManageCovidInfo/GetCovidAbsentismGrapgh
//
// [Authorize]
[HttpPost]
public
HttpResponseMessage GetCovidAbsentismGrapgh(JObject jsonParam)
{
try
{
// UserIdentity UI = new UserIdentity((ClaimsIdentity)User.Identity);
// var UserID = Convert.ToInt32(UI.UserID);
ManageCovidInfo _MCI =
new
ManageCovidInfo();
var CD_Dtls = _MCI.GetCovidAbsentismGrapgh(jsonParam);
response = Request.CreateResponse(HttpStatusCode.OK, CD_Dtls);
}
catch
(Exception ex)
{
response = Request.CreateResponse(JsonConvert.DeserializeObject(
"{\"StatusCode\":\"500\",\"ErrorMessage\":\""
+ ex.Message +
"\"}"
));
}
return
response;
}
Class Part Code
public
DataTable GetCovidAbsentismGrapgh(JObject jsonParam)
{
CovidInfoDetails CID =
new
CovidInfoDetails();
object
[] ParameterValues =
new
object
[1];
ParameterValues[0] = (
string
)jsonParam[
"Company"
];
DataTable dt =
new
DataTable();
try
{
dt = DataAccess.GetDataTable(DBProcedure.GetCovidAbsentismGrapgh, ParameterValues);
}
catch
(Exception ex)
{
}
return
dt;
}
Reply
Answers (
6
)
how to serialize the multi dynamic data in object
How to create a Web service to call a Stored Procedure