2024-04-30 20:55:37 +04:00
|
|
|
|
using ServiceStationContracts.BindingModels;
|
|
|
|
|
using ServiceStationContracts.ViewModels;
|
2024-08-03 23:26:15 +04:00
|
|
|
|
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
|
|
|
|
|
{
|
2024-08-03 23:26:15 +04:00
|
|
|
|
public class Report : ITaskModel
|
2024-04-30 20:55:37 +04:00
|
|
|
|
{
|
|
|
|
|
[Required]
|
|
|
|
|
public int Count { get; set; }
|
|
|
|
|
|
2024-08-03 23:26:15 +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 23:26:15 +04:00
|
|
|
|
Id = model.Id,
|
2024-04-30 20:55:37 +04:00
|
|
|
|
Count = model.Count
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-08-03 23:26:15 +04:00
|
|
|
|
public static Report? Create(TaskViewModel model)
|
2024-04-30 20:55:37 +04:00
|
|
|
|
{
|
|
|
|
|
return new Report
|
|
|
|
|
{
|
2024-08-03 23:26:15 +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;
|
|
|
|
|
|
|
|
|
|
}
|
2024-08-03 23:26:15 +04:00
|
|
|
|
public TaskViewModel GetViewModel => new()
|
2024-04-30 20:55:37 +04:00
|
|
|
|
{
|
2024-08-03 23:26:15 +04:00
|
|
|
|
Id = Id,
|
2024-04-30 20:55:37 +04:00
|
|
|
|
Count = Count
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|