41 lines
839 B
C#
41 lines
839 B
C#
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
|
|
};
|
|
}
|
|
}
|