我正在使用MVC进行应用程序。我正在使用存储过程列出一些 值。我在控制器中调用该程序。
我的程序是
ALTER procedure [dbo].[spGetWaitingList]
@BusinessUserId int
As
Begin
SELECT WorkHour.WorkHourId, WorkHour.EndTime, WorkHour.Description, tblApp.EndDate
FROM WorkHour INNER JOIN
tblApp ON WorkHour.BusinessUserId = tblApp.UserId2 and WorkHour.EndTime < Cast (tblApp.EndDate as Time)
End
我的控制器代码是
var parameters = new SqlParameter[1];
parameters[0] = new SqlParameter { ParameterName = "BusinessUserId", Value = id };
List<Appt> wt = new List<Appt>();
using (SYTEntities context = new SYTEntities())
{
wt = context.Database.SqlQuery<Appt>("exec spGetWaitingList @BusinessUserId", parameters).ToList();
}
我的模特Appt
public class Appt
{
public int BusinessID { get; set; }
public string FirstName { get; set; }
public string BusinessName { get; set; }
public string BusinessCategory { get; set; }
public int UserID { get; set; }
public int UserTypeID { get; set; }
public int Id { get; set; }
public TimeSpan StartTime { get; set; }
public TimeSpan EndTime { get; set; }
public string AddCustomer { get; set; }
public string EndDate { get; set; }
public DateTime HolidayDate { get; set; }
public string HolidayDesc { get; set; }
}
在数据库中,我将结束时间指定为数据类型TIME
任何人都可以帮我解决这个问题吗? 提前谢谢。