55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
|
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; }
|
|||
|
|
|||
|
public int Id { get; set; }
|
|||
|
public static Report? Create(ReportBindingModel? model)
|
|||
|
{
|
|||
|
if (model == null)
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
return new Report()
|
|||
|
{
|
|||
|
Id = model.Id,
|
|||
|
Count = model.Count
|
|||
|
};
|
|||
|
}
|
|||
|
public static Report? Create(ReportViewModel model)
|
|||
|
{
|
|||
|
return new Report
|
|||
|
{
|
|||
|
Id = model.Id,
|
|||
|
Count = model.Count,
|
|||
|
};
|
|||
|
}
|
|||
|
public void Update(ReportBindingModel model)
|
|||
|
{
|
|||
|
if (model == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
Count = model.Count;
|
|||
|
|
|||
|
}
|
|||
|
public ReportViewModel GetViewModel => new()
|
|||
|
{
|
|||
|
Id = Id,
|
|||
|
Count = Count
|
|||
|
};
|
|||
|
}
|
|||
|
}
|