initial commit
This commit is contained in:
77
CityInfo.API/Models/CityDataStore.cs
Normal file
77
CityInfo.API/Models/CityDataStore.cs
Normal 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."
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
16
CityInfo.API/Models/CityDto.cs
Normal file
16
CityInfo.API/Models/CityDto.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
9
CityInfo.API/Models/CityWithoutPointsOfInterestDto.cs
Normal file
9
CityInfo.API/Models/CityWithoutPointsOfInterestDto.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
9
CityInfo.API/Models/PointOfInterestDto.cs
Normal file
9
CityInfo.API/Models/PointOfInterestDto.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
14
CityInfo.API/Models/PointOfInterestForCreationDto.cs
Normal file
14
CityInfo.API/Models/PointOfInterestForCreationDto.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
14
CityInfo.API/Models/PointOfInterestForUpdateDto.cs
Normal file
14
CityInfo.API/Models/PointOfInterestForUpdateDto.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user