내 코스에 코스, 제공 강좌, 코스 등록 테이블, 섹션 테이블이 있습니다. 각 사용자의 강좌 등록 시스템을 구현하고 싶습니다. 이것은 프로젝트의 데이터베이스 다이어그램입니다.
이와 같은 기능을 구현하고 싶습니다. 나는asp.net mvc를 사용하여 라디오 버튼 그룹을 구현하는 방법
class time . public class Course
{
[Key]
public int CourseId { get; set; }
[Required]
public string Name { get; set; }
public string Code { get; set; }
public string Credit { get; set; }
public DateTime RegDate { get; set; }
public string PreCourse { get; set; }
public int DepartmentId { get; set; }
[ForeignKey("DepartmentId")]
public virtual Department Department { get; set; }
public virtual ICollection<OfferedCourse> OfferedCourses { get; set; }
}
이 내 코스 모델의 기능,
public class Department
{
[Key]
public int DepartmentId { get; set; }
[Required]
public string Name { get; set; }
[Required]
public string Code { get; set; }
public virtual ICollection<ApplicationUser> ApplicationUsers { get; set; }
public virtual ICollection<Course> Courses { get; set; }
}
를 구현하지 않는이 내 부서 모델,
public class OfferedCourse
{
[Key]
public int OfferedCourseId { get; set; }
public int Capacity { get; set; }
public bool Status { get; set; }
public int CourseId { get; set; }
[ForeignKey("CourseId")]
public virtual Course Course { get; set; }
public string TeacherId { get; set; }
[ForeignKey("TeacherId")]
public virtual ApplicationUser ApplicationUser { get; set; }
public int SectionId { get; set; }
[ForeignKey("SectionId")]
public virtual Section Section { get; set; }
public int SemesterId { get; set; }
[ForeignKey("SemesterId")]
public virtual Semester Semester { get; set; }
public virtual ICollection<CourseRegistration> CourseRegistrations { get; set; }
}
이 각 학기 내 제공되는 과정입니다.
public class Section
{
[Key]
public int SectionId { get; set; }
public string Title { get; set; }
}
이것은 내 섹션 모델입니다.이 프로젝트에서 교사, 학생 같은 사용자를 관리하기 위해 asp.net ID 프레임 워크를 사용하고 있습니다. 그러나 수강 신청보기에서 라디오 버튼을 관리하는 여러 방법을 시도했습니다. 내가 섹션 물론 이름과 같은 데이터의 다른 유형을 가지고 있기 때문에 내가 어떻게이
이미지는 라디오 버튼이 아닌 체크 상자를 보여줍니다. 모델에서 제안한대로 여러 코스를 선택하려고한다고 가정하면 [이 답변] (http://stackoverflow.com/questions/29542107/pass-list-of-checkboxes-into-view-and-pull-out- ienumerable/29554416 # 29554416)보기 모델 및보기의 일반적인 예를 보려면 –
예. 라디오 버튼이 필요합니다 .. 어떻게하면됩니까 .... 뷰 모델이 필요합니다.하지만 어떻게 구현할 수 있습니까? –
죄송합니다. 불가능합니다. 당신이 보여준 것을 이해하십시오. "과학 학사 ...."당신의'Section.Title' 속성입니까? 그 아래에있는 3 개의 아이템은 그 섹션을위한'OfferedCourses'입니까? 당신은 그 중 3 개 중 하나만 선택하고 싶습니까? –