41 lines
907 B
C#
41 lines
907 B
C#
using DataContracts.bindingModels;
|
|
using DataContracts.models;
|
|
using DataContracts.viewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DatabaseImplement.models
|
|
{
|
|
public class Product : IProduct
|
|
{
|
|
public int Id { get; set; }
|
|
[Required]
|
|
public string title { get; set; } = string.Empty;
|
|
public static Product Create(ProductBindingModel model)
|
|
{
|
|
return new Product()
|
|
{
|
|
Id = model.Id,
|
|
title = model.title
|
|
};
|
|
}
|
|
|
|
public void Update(ProductBindingModel model)
|
|
{
|
|
title = model.title;
|
|
}
|
|
|
|
public ProductViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
title = title,
|
|
|
|
};
|
|
|
|
}
|
|
}
|