initial commit

This commit is contained in:
2026-03-20 23:52:10 +01:00
parent 05bea695bd
commit ce04cd8d77
38 changed files with 3006 additions and 52 deletions

View File

@@ -0,0 +1,77 @@
namespace CityInfo.API.Models
{
public class CityDataStore
{
public List<CityDto> Cities { get; set; }
public CityDataStore()
{
Cities = new List<CityDto>()
{
new CityDto()
{
Id = 1,
Name = "New York City",
Description = "The one with that big park.",
PointsOfInterest = new List<PointOfInterestDto>()
{
new PointOfInterestDto()
{
Id = 1,
Name = "Central Park",
Description = "The most visited urban park in the United States."
},
new PointOfInterestDto()
{
Id = 2,
Name = "Empire State Building",
Description = "A 102 Story skyscrapper located in Midtown Manathan."
}
}
},
new CityDto()
{
Id = 2,
Name = "Antwerp",
Description = "The one with the cathedral that was never really finished.",
PointsOfInterest = new List<PointOfInterestDto>()
{
new PointOfInterestDto()
{
Id = 3,
Name = "Antwerp Cathedral",
Description = "a beautiful Cathedral"
},
new PointOfInterestDto()
{
Id = 4,
Name = "Antwerp central station",
Description = "A train station"
}
}
},
new CityDto()
{
Id = 3,
Name = "Paris",
Description = "The one with that big tower.",
PointsOfInterest = new List<PointOfInterestDto>()
{
new PointOfInterestDto()
{
Id = 5,
Name = "Eiffel Tower",
Description = "A big tower."
},
new PointOfInterestDto()
{
Id = 6,
Name = "The Louvre",
Description = "A Museum."
}
}
},
};
}
}
}

View File

@@ -0,0 +1,16 @@
namespace CityInfo.API.Models
{
public class CityDto
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public int NumberOfPointsOfInterest {
get
{
return PointsOfInterest.Count;
}
}
public ICollection<PointOfInterestDto> PointsOfInterest { get; set; } = new List<PointOfInterestDto>();
}
}

View File

@@ -0,0 +1,9 @@
namespace CityInfo.API.Models
{
public class CityWithoutPointsOfInterestDto
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace CityInfo.API.Models
{
public class PointOfInterestDto
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace CityInfo.API.Models
{
public class PointOfInterestForCreationDto
{
[Required(ErrorMessage = "You should provide a name value.")]
[MaxLength(50)]
public string Name { get; set; } = string.Empty;
[MaxLength(200)]
public string? Description { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace CityInfo.API.Models
{
public class PointOfInterestForUpdateDto
{
[Required(ErrorMessage = "You should provide a name value.")]
[MaxLength(50)]
public string Name { get; set; } = string.Empty;
[MaxLength(200)]
public string? Description { get; set; }
}
}