2024-04-30 20:55:37 +04:00
|
|
|
|
using ServiceStationContracts.BindingModels;
|
|
|
|
|
using ServiceStationContracts.ViewModels;
|
|
|
|
|
using ServiceStationDataModels;
|
|
|
|
|
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 : IReportModel
|
|
|
|
|
{
|
|
|
|
|
[Required]
|
|
|
|
|
public int Count { get; set; }
|
|
|
|
|
|
2024-08-03 19:12:18 +04:00
|
|
|
|
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()
|
|
|
|
|
{
|
2024-08-03 19:12:18 +04:00
|
|
|
|
ID = model.ID,
|
2024-04-30 20:55:37 +04:00
|
|
|
|
Count = model.Count
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
public static Report? Create(ReportViewModel model)
|
|
|
|
|
{
|
|
|
|
|
return new Report
|
|
|
|
|
{
|
2024-08-03 19:12:18 +04:00
|
|
|
|
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 ReportViewModel GetViewModel => new()
|
|
|
|
|
{
|
2024-08-03 19:12:18 +04:00
|
|
|
|
ID = ID,
|
2024-04-30 20:55:37 +04:00
|
|
|
|
Count = Count
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|