public JsonResult SaveTimeSheet(Guid TimesheetID, List<TaskHours> TaskHours)
{
TimeSheet timeSheet = new TimeSheet();
TimeSheetData timesheetdata = new TimeSheetData();
timesheetdata.TimeSheet = TimesheetID;
}
收到此错误:
无法将系统guid隐式转换为TSM.Models.TimeSheets.TimeSheet
我想通过assign
在timesheetdata.TimeSheet中获取Guid TimesheetID对象public class TimeSheetData
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid ID { get; set;}
public double Hours { get; set;}
public DateTime Date { get; set; }
public Guid TaskID { get; set; }
public virtual TimeSheet TimeSheet { get; set; }
}
答案 0 :(得分:2)
时间表中的Guid类型不是System.Guid。您必须选择是使用System.Guid还是您自己定义的Guid。