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

55 lines
1.3 KiB
C#
Raw Normal View History

2024-04-30 20:55:37 +04:00
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using ServiceStationDataModels.Models;
2024-04-30 20:55:37 +04:00
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsDataBaseImplement.Models
{
public class Report : ITaskModel
2024-04-30 20:55:37 +04:00
{
[Required]
public int Count { get; set; }
public int Id { get; set; }
2024-04-30 20:55:37 +04:00
public static Report? Create(ReportBindingModel? model)
{
if (model == null)
{
return null;
}
return new Report()
{
Id = model.Id,
2024-04-30 20:55:37 +04:00
Count = model.Count
};
}
public static Report? Create(TaskViewModel model)
2024-04-30 20:55:37 +04:00
{
return new Report
{
Id = model.Id,
2024-04-30 20:55:37 +04:00
Count = model.Count,
};
}
public void Update(ReportBindingModel model)
{
if (model == null)
{
return;
}
Count = model.Count;
}
public TaskViewModel GetViewModel => new()
2024-04-30 20:55:37 +04:00
{
Id = Id,
2024-04-30 20:55:37 +04:00
Count = Count
};
}
}