0% found this document useful (0 votes)
0 views2 pages

Using System

The document defines two classes, Organizer and Festival, using C# data annotations for validation in a .NET application. The Organizer class includes properties for ID, name, type, and experience, while the Festival class includes properties for ID, name, date, location, and a foreign key reference to an Organizer. Additionally, a FestivalOrganizerViewModel class is provided to encapsulate festival and organizer information for view purposes.

Uploaded by

cloneofninh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views2 pages

Using System

The document defines two classes, Organizer and Festival, using C# data annotations for validation in a .NET application. The Organizer class includes properties for ID, name, type, and experience, while the Festival class includes properties for ID, name, date, location, and a foreign key reference to an Organizer. Additionally, a FestivalOrganizerViewModel class is provided to encapsulate festival and organizer information for view purposes.

Uploaded by

cloneofninh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

using [Link].

DataAnnotations;
namespace [Link]
{
public class Organizer
{
[Key]
public int OrganizerId { get; set; }
[Required(ErrorMessage = "Tên nhà tổ chức là bắt buộc")]
[StringLength(100, MinimumLength = 3)]
public string? Name { get; set; }
[Required]
public string? Type { get; set; }
[Range(0, 50, ErrorMessage = "Kinh nghiệm phải từ 0 đến
50 năm")]
public int Experience { get; set; }
public virtual ICollection<Festival>? Festivals { get; set; }
using [Link];
using [Link];
namespace [Link]
{
public class Festival
{
[Key]
public int FestivalId { get; set; }
[Required(ErrorMessage = "Tên lễ hội không được để
trống")]
[StringLength(200)]
public string? Name { get; set; }
1
[DataType([Link])]
public DateTime Date { get; set; }
[Required]
public string? Location { get; set; }
// Foreign Key
public int OrganizerId { get; set; }
[ForeignKey("OrganizerId")]
public virtual Organizer? Organizer { get; set; }
namespace [Link]
{
public class FestivalOrganizerViewModel
{
public int FestivalId { get; set; }
public string? FestivalName { get; set; }
public DateTime Date { get; set; }
public string? Location { get; set; }
public string? OrganizerName { get; set; }
public string? OrganizerType { get; set; }

You might also like