2024-11-11 22:20:20 +04:00

41 lines
900 B
C#

using Contracts.BindingModels;
using Contracts.ViewModels;
using Models.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement.Models
{
public class Category : ICategoryModel
{
public int Id { get; set; }
public string Name { get; set; }
public static Category? Create(CategoryBindingModel model)
{
if (model == null) return null;
return new Category
{
Id = model.Id,
Name = model.Name,
};
}
public void Update(CategoryBindingModel model)
{
if (model == null) return;
Name = model.Name;
}
public CategoryViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
};
}
}