httpmessagecontent in mvc api

本文关键字:api mvc in httpmessagecontent | 更新日期: 2023-09-27 17:59:01

使用方法httpmessagecontent时如何返回datetime(我正在建立一个接收并返回android工作室的网站。)这是我的功能代码:

[HttpGet]
public HttpMessageContent TurnDetails(string ServiceName)
{
    int a = db.Sessions.Where(k => k.Service.Description == ServiceName).Count();
    var r = db.Services.Where(l => l.Description == ServiceName).Select((l => l.SessionLength));
    var f = db.Services.Where(k => k.Description == ServiceName).Select(k => k.Openinghours.Select(p => p.OpenTime));
    a = a * Convert.ToInt32(r) + Convert.ToInt32(f);
    Convert.ToDateTime(a);
    return a;
}

httpmessagecontent in mvc api

不应该是吗

return Convert.ToDateTime(a);

Convert.ToDateTime不会就地修改提供的参数。您必须使用函数返回的值。