-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourse.cs
More file actions
84 lines (64 loc) · 2.53 KB
/
Course.cs
File metadata and controls
84 lines (64 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using CourseNet.Data.Models.Entities.Enums;
using Microsoft.EntityFrameworkCore;
using static CourseNet.Common.DataConstants.Course;
namespace CourseNet.Data.Models.Entities
{
[Comment("Course Table")]
public class Course
{
public Course()
{
this.Id = System.Guid.NewGuid();
}
[Comment("Course Identifier")]
[Key]
public Guid Id { get; set; }
[Comment("Course Title")]
[Required]
[MaxLength(TitleMaxLength)]
public string Title { get; set; } = string.Empty;
[Comment("Course Description")]
[Required]
[MaxLength(DescriptionMaxLength)]
public string Description { get; set; } = string.Empty;
[Comment("Course Image Path")]
[Required(AllowEmptyStrings = false)]
public string ImagePath { get; set; } = string.Empty;
[Comment("Course Creation Date")]
[Required]
public DateTime CreatedOn { get; set; }
[Comment("Course End Date")]
[Required]
public DateTime EndDate { get; set; }
[Comment("Course Price")]
[Required]
[Column(TypeName = "Decimal(18,2)")]
public decimal Price { get; set; }
[Comment("Course Instructor Identifier")]
[Required]
public Guid InstructorId { get; set; }
[Comment("Course Instructor")]
public Instructor Instructor { get; set; }
[Comment("Course Difficulty Level")]
public DifficultyLevel Difficulty { get; set; }
[Comment("Course Status")]
public CourseStatus Status { get; set; }
[Comment("Student Identifier")]
public Guid? StudentId { get; set; }
[Comment("Student")]
[ForeignKey(nameof(StudentId))]
public virtual CourseUser? Student { get; set; }
[Comment("Category Identifier")]
public int CategoryId { get; set; }
[Comment("Category")]
public virtual Category Category { get; set; }
[Comment("Collection of Categories")]
public virtual ICollection<Category> Categories { get; set; } = new HashSet<Category>();
[Comment("Collection of Lectures")]
public virtual ICollection<Lecture> Lectures { get; set; } = new HashSet<Lecture>();
public virtual ICollection<Material> Materials { get; set; } = new HashSet<Material>();
public virtual ICollection<Review> Reviews { get; set; } = new HashSet<Review>();
}
}