c# - 无论日期如何,如何设置特定的时间范围(例如从 07:00 到 12:00)
问题描述
我正在尝试创建一个类,其中Physician.cs有一个ICollection Appointmets属性,其中包含 DateTime 但我正在尝试创建Workday类,医生可以在其中说从他开始到他完成工作日的时间(例如星期一从 07 :00 至 13:00,无论日期如何)。
我是否需要将 DateTime 声明为Workday类中Start和Finish的属性的数据类型?
医师.cs
using System.Collections.Generic;
namespace Med_App_API.Models
{
public class Physician
{
public int Id { get; set; }
public int UserId { get; set; }
public User User { get; set; }
public ICollection<Patient> Patients { get; set; }
public ICollection<Appointments> Appointments { get; set; }
}
}
约会.cs
using System;
namespace Med_App_API.Models
{
public class Appointments
{
public int Id { get; set; }
public int PatientId { get; set; }
public Patient Patient { get; set; }
public int PhysicianId { get; set; }
public Physician Physician { get; set; }
public DateTime TimeofAppointment { get; set; }
public string TypeOfAppointment { get; set; }
}
}
工作日.cs
using System;
namespace Med_App_API.Models
{
public class Workday
{
public int Id { get; set; }
public int PhysicianId { get; set; }
public Physician Physician { get; set; }
public DateTime Start { get; set; }
public DateTime Finish { get; set; }
}
}