using Contracts.BindingModels; using Contracts.ViewModels; using DataModels; using System.ComponentModel.DataAnnotations; namespace DataBaseImplements.Models { public class City : ICityModel { public int Id { get; set; } [Required] public string Name { get; set; } = string.Empty; public static City? Create(CityBindingModel model) { return new City { Id = model.Id, Name = model.Name }; } public void Update(CityBindingModel model) { Name = model.Name; } public CityViewModel GetViewModel => new() { Id = Id, Name = Name, }; } }