Gismatullin.ISEbd-21.STO.Co.../ServiceStation/ServiceStationsDataBaseImplement/Models/TaskByWork.cs

41 lines
839 B
C#
Raw Normal View History

2024-08-10 18:43:15 +04:00
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
namespace ServiceStationsDataBaseImplement.Models {
public class TaskByWork : ITaskModel {
public int Id { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
public static TaskByWork? Create(TaskBindingModel? model) {
if (model == null) {
return null;
}
return new TaskByWork() {
Id = model.Id,
Name = model.Name
};
}
public void Update(TaskBindingModel? model) {
if (model == null) {
return;
}
Name = model.Name;
}
public TaskViewModel GetViewModel => new() {
Id = Id,
Name = Name
};
}
}