using Core.Abstractions.Models; using Core.DomainObjects; using Core.DomainObjects.Documents; namespace WeatherForecast.Models.Requests { public class PutShopCartItemRequestModel : RequestModelBase { public string Slug { get; set; } public ImageModel Image { get; set; } public string Title { get; set; } public string BrandName { get; set; } public string ShortText { get; set; } public DateTime Created { get; set; } public double Price { get; set; } public double NewPrice { get; set; } public uint Quantity { get; set; } public override ShopCartItem ApplyTo(ShopCartItem shopCart) { shopCart.Slug = Slug; shopCart.Image = new Image { Src = Image.Src, Alt = Image.Alt }; shopCart.Title = Title; shopCart.BrandName = BrandName; shopCart.ShortText = ShortText; shopCart.Created = Created; shopCart.Price = Price; shopCart.NewPrice = NewPrice; shopCart.Quantity = Quantity; return shopCart; } public override ShopCartItem ToDomainObject() => ApplyTo(new ShopCartItem()); } }