我正在尝试从API中提取数据,当我拉(或只是获取整个数组)时,我需要从数组中获取一些数据。
我在C#asp.net实体框架
Date string
IsPublicHoliday bool
Shifts = array
employeeId guid
startDate string
startTime string
duration int
unpaidBreaks int
notes string
roleId guid
Status byte 0 = Draft, 1 = Published, 2 = Confirmed, 3 = Queried
Costs array
employeeId guid
date string In yyyy-MM-dd format
actual object
cost decimal
additionalCost decimal
estimated object
cost decimal
additionalCost decimal
所以我需要引入Date,一些来自shift数组,一些来自成本数组。
我目前的班级结构是:
public partial class RosterTime
{
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int SiteID { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RosterTimesUniqueID { get; set; }
public int RosterTime_Key { get; set; }
public int Contacts_Key { get; set; }
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
public TimeSpan? Breaks { get; set; }
public double? Hourly_Rate { get; set; }
public string PayrollID { get; set; }
[NotMapped]
public Array Shifts { get; set; }
[NotMapped]
public Array Costs { get; set; }
我的要求是这样的:
public List<RosterTime> RosterData(string rosterId)
{
var request = Request("roster-data/" + rosterId + "?startDate=" + DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd") + "&endDate=" +
DateTime.Now.AddMonths(2).ToString("yyyy-MM-dd"));
var result = _client.Execute<List<RosterTime>>(request);
return result.Data;
}
如何从这两个数组中获取信息并保存数据?
编辑: 轮班:
public class Shifts
{
public Guid employeeId { get; set; }
public string startDate { get; set; }
public string startTime { get; set; }
public int duration { get; set; }
}