38 lines
917 B
C#
38 lines
917 B
C#
|
using Contracts.BindingModels;
|
|||
|
using Contracts.ViewModels;
|
|||
|
using DataModels.Models;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel.DataAnnotations;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace DatabaseImplements.Models
|
|||
|
{
|
|||
|
public class Type : ITypeModel
|
|||
|
{
|
|||
|
public int Id { get; private set; }
|
|||
|
[Required]
|
|||
|
public string PostType { get; private set; } = string.Empty;
|
|||
|
public static Type? Create(TypeBindingModel model)
|
|||
|
{
|
|||
|
return new Type()
|
|||
|
{
|
|||
|
Id = model.Id,
|
|||
|
PostType = model.PostType,
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
public void Update(TypeBindingModel model)
|
|||
|
{
|
|||
|
PostType = model.PostType;
|
|||
|
}
|
|||
|
public TypeViewModel GetViewModel => new()
|
|||
|
{
|
|||
|
Id = Id,
|
|||
|
PostType = PostType,
|
|||
|
};
|
|||
|
}
|
|||
|
}
|