diff --git a/NorthwindCRUD/Controllers/CategoriesController.cs b/NorthwindCRUD/Controllers/CategoriesController.cs index 83fcb7a..d1c2143 100644 --- a/NorthwindCRUD/Controllers/CategoriesController.cs +++ b/NorthwindCRUD/Controllers/CategoriesController.cs @@ -1,13 +1,11 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NorthwindCRUD.Models.DbModels; using NorthwindCRUD.Models.Dtos; using NorthwindCRUD.Services; - using Swashbuckle.AspNetCore.Annotations; [ApiController] [Route("[controller]")] @@ -52,8 +50,8 @@ public ActionResult GetAll() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetCategoriesWithSkip")] public ActionResult> GetCategoriesWithSkip( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/CustomersController.cs b/NorthwindCRUD/Controllers/CustomersController.cs index 9e4aaf4..cc6dd77 100644 --- a/NorthwindCRUD/Controllers/CustomersController.cs +++ b/NorthwindCRUD/Controllers/CustomersController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -51,8 +50,8 @@ public ActionResult GetAll() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetCustomersWithSkip")] public ActionResult> GetCustomersWithSkip( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/EmployeesController.cs b/NorthwindCRUD/Controllers/EmployeesController.cs index a7b20bf..f220dd0 100644 --- a/NorthwindCRUD/Controllers/EmployeesController.cs +++ b/NorthwindCRUD/Controllers/EmployeesController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -69,8 +68,8 @@ public ActionResult GetAllAuthorized() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetEmployeesWithSkip")] public ActionResult> GetPagedEmployees( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/OrdersController.cs b/NorthwindCRUD/Controllers/OrdersController.cs index e1ef0a3..acd1e5f 100644 --- a/NorthwindCRUD/Controllers/OrdersController.cs +++ b/NorthwindCRUD/Controllers/OrdersController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -57,8 +56,8 @@ public ActionResult GetAll() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetPagedOrders")] public ActionResult> GetAllOrders( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/ProductsController.cs b/NorthwindCRUD/Controllers/ProductsController.cs index b3c8a26..0315470 100644 --- a/NorthwindCRUD/Controllers/ProductsController.cs +++ b/NorthwindCRUD/Controllers/ProductsController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -71,8 +70,8 @@ public ActionResult GetAllAuthorized() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetPagedProducts")] public ActionResult> GetAllProducts( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/RegionsController.cs b/NorthwindCRUD/Controllers/RegionsController.cs index 3830dbc..29b6a50 100644 --- a/NorthwindCRUD/Controllers/RegionsController.cs +++ b/NorthwindCRUD/Controllers/RegionsController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -51,8 +50,8 @@ public ActionResult GetAll() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetPagedRegions")] public ActionResult> GetAllRegions( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/ShippersController.cs b/NorthwindCRUD/Controllers/ShippersController.cs index 0a28356..9924c2c 100644 --- a/NorthwindCRUD/Controllers/ShippersController.cs +++ b/NorthwindCRUD/Controllers/ShippersController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -51,8 +50,8 @@ public ActionResult GetAll() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetPagedShippersWithSkip")] public ActionResult> GetPagedShippersWithSkip( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/SuppliersController.cs b/NorthwindCRUD/Controllers/SuppliersController.cs index c8b65e6..0914ed9 100644 --- a/NorthwindCRUD/Controllers/SuppliersController.cs +++ b/NorthwindCRUD/Controllers/SuppliersController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -51,8 +50,8 @@ public ActionResult GetAll() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetPagedSuppliers")] public ActionResult> GetAllSuppliers( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Controllers/TerritoriesController.cs b/NorthwindCRUD/Controllers/TerritoriesController.cs index e96ba59..05f160d 100644 --- a/NorthwindCRUD/Controllers/TerritoriesController.cs +++ b/NorthwindCRUD/Controllers/TerritoriesController.cs @@ -1,6 +1,5 @@ namespace NorthwindCRUD.Controllers { - using System.ComponentModel.DataAnnotations; using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -53,8 +52,8 @@ public ActionResult GetAll() /// A PagedResultDto object containing the fetched T and the total record count. [HttpGet("GetPagedTerritories")] public ActionResult> GetAllTerritories( - [FromQuery][Attributes.SwaggerSkipParameter][Range(0, int.MaxValue)] int? skip, - [FromQuery][Attributes.SwaggerTopParameter][Range(0, int.MaxValue)] int? top, + [FromQuery][Attributes.SwaggerSkipParameter] int? skip, + [FromQuery][Attributes.SwaggerTopParameter] int? top, [FromQuery][Attributes.SwaggerOrderByParameter] string? orderBy) { try diff --git a/NorthwindCRUD/Models/Dtos/AddressDto.cs b/NorthwindCRUD/Models/Dtos/AddressDto.cs index 1ae2ce7..fbef3b4 100644 --- a/NorthwindCRUD/Models/Dtos/AddressDto.cs +++ b/NorthwindCRUD/Models/Dtos/AddressDto.cs @@ -5,23 +5,17 @@ namespace NorthwindCRUD.Models.Dtos { public class AddressDto : IAddress { - [StringLength(100, ErrorMessage = "Street cannot exceed 100 characters.")] public string Street { get; set; } - [StringLength(50, ErrorMessage = "City cannot exceed 50 characters.")] public string City { get; set; } - [StringLength(50, ErrorMessage = "Region cannot exceed 50 characters.")] public string Region { get; set; } - [StringLength(20, ErrorMessage = "Postal code cannot exceed 20 characters.")] public string PostalCode { get; set; } [Required(ErrorMessage = "Country is required.")] - [StringLength(50, ErrorMessage = "Country cannot exceed 50 characters.")] public string Country { get; set; } - [RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Phone number is not valid.")] public string? Phone { get; set; } } } diff --git a/NorthwindCRUD/Models/Dtos/CategoryDetailsDto.cs b/NorthwindCRUD/Models/Dtos/CategoryDetailsDto.cs index 62e0d41..36b590c 100644 --- a/NorthwindCRUD/Models/Dtos/CategoryDetailsDto.cs +++ b/NorthwindCRUD/Models/Dtos/CategoryDetailsDto.cs @@ -5,7 +5,6 @@ namespace NorthwindCRUD.Models.Dtos { public class CategoryDetailsDto : CategoryDto, ICategoryDetail { - [RegularExpression(@"^(http[s]?://.*\.(?:jpg|jpeg|png|gif))$", ErrorMessage = "Picture URL must start with http/s and end with .jpg, .jpeg, .png, or .gif.")] public string Picture { get; set; } } } diff --git a/NorthwindCRUD/Models/Dtos/CategoryDto.cs b/NorthwindCRUD/Models/Dtos/CategoryDto.cs index ac04f4b..34b7158 100644 --- a/NorthwindCRUD/Models/Dtos/CategoryDto.cs +++ b/NorthwindCRUD/Models/Dtos/CategoryDto.cs @@ -7,11 +7,9 @@ public class CategoryDto : ICategory { public int CategoryId { get; set; } - [StringLength(500, ErrorMessage = "Description cannot exceed 500 characters.")] public string Description { get; set; } [Required(ErrorMessage = "Name is required.")] - [StringLength(50, MinimumLength = 3, ErrorMessage = "Name must be between 3 and 50 characters.")] public string Name { get; set; } } } diff --git a/NorthwindCRUD/Models/Dtos/CustomerDto.cs b/NorthwindCRUD/Models/Dtos/CustomerDto.cs index 47a55ae..ba10ed5 100644 --- a/NorthwindCRUD/Models/Dtos/CustomerDto.cs +++ b/NorthwindCRUD/Models/Dtos/CustomerDto.cs @@ -8,13 +8,10 @@ public class CustomerDto : ICustomer public string CustomerId { get; set; } [Required(ErrorMessage = "Company Name is required.")] - [StringLength(100, ErrorMessage = "Company Name cannot exceed 100 characters.")] public string CompanyName { get; set; } - [StringLength(50, ErrorMessage = "Contact Name cannot exceed 50 characters.")] public string ContactName { get; set; } - [StringLength(50, ErrorMessage = "Contact Title cannot exceed 50 characters.")] public string ContactTitle { get; set; } public AddressDto Address { get; set; } diff --git a/NorthwindCRUD/Models/Dtos/EmployeeDto.cs b/NorthwindCRUD/Models/Dtos/EmployeeDto.cs index 31c70c4..99a0d46 100644 --- a/NorthwindCRUD/Models/Dtos/EmployeeDto.cs +++ b/NorthwindCRUD/Models/Dtos/EmployeeDto.cs @@ -10,29 +10,21 @@ public class EmployeeDto : IEmployee public int EmployeeId { get; set; } [Required(ErrorMessage = "Last name is required.")] - [StringLength(50, ErrorMessage = "Last name cannot exceed 50 characters.")] [SwaggerSchema("Employee's last name.")] public string LastName { get; set; } - [StringLength(50, ErrorMessage = "First name cannot exceed 50 characters.")] [SwaggerSchema("Employee's first name.")] public string FirstName { get; set; } - [StringLength(50, ErrorMessage = "Title cannot exceed 50 characters.")] [SwaggerSchema("Employee's title")] public string Title { get; set; } - [StringLength(50, ErrorMessage = "Title of courtesy cannot exceed 50 characters.")] [SwaggerSchema("Title used in salutations")] public string TitleOfCourtesy { get; set; } - [DataType(DataType.Date, ErrorMessage = "BirthDate must be a valid date.")] - [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")] [SwaggerSchema("Employee's birth date")] public string BirthDate { get; set; } - [DataType(DataType.Date, ErrorMessage = "HireDate must be a valid date.")] - [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")] [SwaggerSchema("Employee's hire date")] public string HireDate { get; set; } @@ -40,15 +32,12 @@ public class EmployeeDto : IEmployee public AddressDto Address { get; set; } - [StringLength(1000, ErrorMessage = "Notes cannot exceed 1000 characters.")] [SwaggerSchema("General information about employee's background.")] public string Notes { get; set; } - [RegularExpression(@"^https?:\/\/.+\..+", ErrorMessage = "Avatar URL is not valid.")] [SwaggerSchema("Employee's avatar url.")] public string AvatarUrl { get; set; } - [Range(1, int.MaxValue, ErrorMessage = "ReportsTo must be a valid employee ID.")] [SwaggerSchema("Employee's supervisor.")] public int ReportsTo { get; set; } } diff --git a/NorthwindCRUD/Models/Dtos/LoginDto.cs b/NorthwindCRUD/Models/Dtos/LoginDto.cs index f3f8648..b76b854 100644 --- a/NorthwindCRUD/Models/Dtos/LoginDto.cs +++ b/NorthwindCRUD/Models/Dtos/LoginDto.cs @@ -1,11 +1,9 @@ -using System.ComponentModel.DataAnnotations; -using NorthwindCRUD.Models.Contracts; +using NorthwindCRUD.Models.Contracts; namespace NorthwindCRUD.Models.Dtos { public class LoginDto : IUser { - [EmailAddress] public string Email { get; set; } public string Password { get; set; } diff --git a/NorthwindCRUD/Models/Dtos/OrderDetailDto.cs b/NorthwindCRUD/Models/Dtos/OrderDetailDto.cs index b008471..f370893 100644 --- a/NorthwindCRUD/Models/Dtos/OrderDetailDto.cs +++ b/NorthwindCRUD/Models/Dtos/OrderDetailDto.cs @@ -9,10 +9,8 @@ public class OrderDetailDto public int ProductId { get; set; } - [Range(0.01, double.MaxValue, ErrorMessage = "Unit price must be greater than 0.")] public double UnitPrice { get; set; } - [Range(1, int.MaxValue, ErrorMessage = "Quantity must be at least 1.")] public int Quantity { get; set; } public float Discount { get; set; } diff --git a/NorthwindCRUD/Models/Dtos/OrderDto.cs b/NorthwindCRUD/Models/Dtos/OrderDto.cs index 9d8ebdb..565c0ba 100644 --- a/NorthwindCRUD/Models/Dtos/OrderDto.cs +++ b/NorthwindCRUD/Models/Dtos/OrderDto.cs @@ -11,26 +11,18 @@ public class OrderDto : IOrder [Required(ErrorMessage = "CustomerId is required.")] public string CustomerId { get; set; } - [Range(1, int.MaxValue, ErrorMessage = "EmployeeId must be a valid employee ID.")] public int EmployeeId { get; set; } - [Range(1, int.MaxValue, ErrorMessage = "ShipperId must be a valid shipper ID.")] public int ShipperId { get; set; } - [DataType(DataType.Date, ErrorMessage = "OrderDate must be a valid date.")] - [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")] public string OrderDate { get; set; } - [DataType(DataType.Date, ErrorMessage = "RequiredDate must be a valid date.")] - [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")] public string RequiredDate { get; set; } public Shipping? ShipVia { get; set; } - [Range(0, double.MaxValue, ErrorMessage = "Freight must be a non-negative value.")] public double Freight { get; set; } - [StringLength(100, ErrorMessage = "ShipName cannot exceed 100 characters.")] public string ShipName { get; set; } public bool Completed { get; set; } diff --git a/NorthwindCRUD/Models/Dtos/ProductDto.cs b/NorthwindCRUD/Models/Dtos/ProductDto.cs index 98be8ee..6159499 100644 --- a/NorthwindCRUD/Models/Dtos/ProductDto.cs +++ b/NorthwindCRUD/Models/Dtos/ProductDto.cs @@ -1,5 +1,4 @@ -using System.ComponentModel.DataAnnotations; -using NorthwindCRUD.Models.Contracts; +using NorthwindCRUD.Models.Contracts; namespace NorthwindCRUD.Models.Dtos { @@ -7,25 +6,18 @@ public class ProductDto : IProduct { public int ProductId { get; set; } - [Range(1, int.MaxValue, ErrorMessage = "SupplierId must be a valid supplier ID.")] public int? SupplierId { get; set; } - [Range(1, int.MaxValue, ErrorMessage = "CategoryId must be a valid category ID.")] public int? CategoryId { get; set; } - [StringLength(100, ErrorMessage = "QuantityPerUnit cannot exceed 100 characters.")] public string QuantityPerUnit { get; set; } - [Range(0, double.MaxValue, ErrorMessage = "UnitPrice must be a non-negative value.")] public double? UnitPrice { get; set; } - [Range(0, 1000000000, ErrorMessage = "UnitsInStock must be a non-negative value.")] public int? UnitsInStock { get; set; } - [Range(0, 1000000, ErrorMessage = "UnitsOnOrder must be a non-negative value.")] public int? UnitsOnOrder { get; set; } - [Range(0, int.MaxValue, ErrorMessage = "ReorderLevel must be a non-negative value.")] public int? ReorderLevel { get; set; } public bool Discontinued { get; set; } diff --git a/NorthwindCRUD/Models/Dtos/RegisterDto.cs b/NorthwindCRUD/Models/Dtos/RegisterDto.cs index a17d7c5..ca41e91 100644 --- a/NorthwindCRUD/Models/Dtos/RegisterDto.cs +++ b/NorthwindCRUD/Models/Dtos/RegisterDto.cs @@ -6,7 +6,6 @@ namespace NorthwindCRUD.Models.Dtos public class RegisterDto : IUser { [Required] - [EmailAddress] public string Email { get; set; } [Required] diff --git a/NorthwindCRUD/Models/Dtos/SalesDto.cs b/NorthwindCRUD/Models/Dtos/SalesDto.cs index d554dce..0ee7277 100644 --- a/NorthwindCRUD/Models/Dtos/SalesDto.cs +++ b/NorthwindCRUD/Models/Dtos/SalesDto.cs @@ -7,10 +7,8 @@ public class SalesDto [Required(ErrorMessage = "ProductId is required.")] public int ProductId { get; set; } - [Range(1, int.MaxValue, ErrorMessage = "QuantitySold must be at least 1.")] public int QuantitySold { get; set; } - [Range(0.01, 1000000, ErrorMessage = "SaleAmount must be greater than 0.")] public double SaleAmount { get; set; } } } diff --git a/NorthwindCRUD/Models/Dtos/ShipperDto.cs b/NorthwindCRUD/Models/Dtos/ShipperDto.cs index 8eb852e..a01c71c 100644 --- a/NorthwindCRUD/Models/Dtos/ShipperDto.cs +++ b/NorthwindCRUD/Models/Dtos/ShipperDto.cs @@ -8,10 +8,8 @@ public class ShipperDto : IShipper public int ShipperId { get; set; } [Required(ErrorMessage = "Company Name is required.")] - [StringLength(100, ErrorMessage = "Company Name cannot exceed 100 characters.")] public string CompanyName { get; set; } - [RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Phone number is not valid.")] public string Phone { get; set; } } } diff --git a/NorthwindCRUD/Models/Dtos/SupplierDto.cs b/NorthwindCRUD/Models/Dtos/SupplierDto.cs index b82509a..a96b0e1 100644 --- a/NorthwindCRUD/Models/Dtos/SupplierDto.cs +++ b/NorthwindCRUD/Models/Dtos/SupplierDto.cs @@ -8,37 +8,26 @@ public class SupplierDto : ISupplier public int SupplierId { get; set; } [Required(ErrorMessage = "Company Name is required.")] - [StringLength(100, ErrorMessage = "Company Name cannot exceed 100 characters.")] public string? CompanyName { get; set; } - [StringLength(100, ErrorMessage = "Contact Name cannot exceed 100 characters.")] public string? ContactName { get; set; } - [StringLength(50, ErrorMessage = "Contact Title cannot exceed 50 characters.")] public string? ContactTitle { get; set; } - [StringLength(250, ErrorMessage = "Address cannot exceed 250 characters.")] public string? Address { get; set; } - [StringLength(50, ErrorMessage = "City cannot exceed 50 characters.")] public string? City { get; set; } - [StringLength(50, ErrorMessage = "Region cannot exceed 50 characters.")] public string? Region { get; set; } - [StringLength(20, ErrorMessage = "Postal Code cannot exceed 20 characters.")] public string? PostalCode { get; set; } - [StringLength(50, ErrorMessage = "Country cannot exceed 50 characters.")] public string? Country { get; set; } - [RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Phone number is not valid.")] public string? Phone { get; set; } - [RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Fax number is not valid.")] public string? Fax { get; set; } - [RegularExpression(@"^https?:\/\/[^\s$.?#].[^\s]*$", ErrorMessage = "Home Page URL is not valid.")] public string? HomePage { get; set; } } }