Продолжение(Легендарное)

This commit is contained in:
RavilGismatullin 2024-08-03 22:26:15 +03:00
parent 6d1f93451c
commit 6ee89f6397
49 changed files with 184 additions and 340 deletions

8
12345678 Normal file
View File

@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBdnP+MV4
VwS1yecrAOXrzjAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIKR8odg9m0A3Wn1f
AsD8bFrBr2c7U4gzr34WAPTOClvKAAAAoETF2SR1FCOl3OGFsy+vuQwfqp8qySZsswBKSu
6YTNm65JWix/m2P3bO1mMSiiu6t0olwNQnXz7inHHf7YoIsOskkqMdD9/0wDgmrG/D9Wl1
SEEsIZBNy5u0C4ufdifb6/4zTAMOGcIt8+w1G2jbPvnJ2ez/70aGOANYl6rzsQZS0IdS4X
SADuP5bdG1Q2zaOj5+3bOivM0co10Vkx9hJG4=
-----END OPENSSH PRIVATE KEY-----

1
12345678.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKR8odg9m0A3Wn1fAsD8bFrBr2c7U4gzr34WAPTOClvK rgismatullinm@yandex.ru

View File

@ -14,9 +14,9 @@ namespace ServiceSourceBusinessLogic.BusinessLogic {
public class ReportLogic : IReportLogic { public class ReportLogic : IReportLogic {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IReportStorage _storage; private readonly ITaskStorage _storage;
public ReportLogic(ILogger logger, IReportStorage storage) { public ReportLogic(ILogger logger, ITaskStorage storage) {
_logger = logger; _logger = logger;
_storage = storage; _storage = storage;
} }
@ -49,7 +49,7 @@ namespace ServiceSourceBusinessLogic.BusinessLogic {
return true; return true;
} }
public List<ReportViewModel>? ReadList(ReportSearchModel model) { public List<TaskViewModel>? ReadList(TaskSearchModel model) {
_logger.LogInformation($"ReadList. Id:{model?.Id}"); _logger.LogInformation($"ReadList. Id:{model?.Id}");
var list = model == null ? _storage.GetFullList() : _storage.GetFilteredList(model); var list = model == null ? _storage.GetFullList() : _storage.GetFilteredList(model);
if (list == null) { if (list == null) {

View File

@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ServiceSourceBusinessLogic.BusinessLogic { namespace ServiceSourceBusinessLogic.BusinessLogic {
public class ReportWork : IReportWorkLogic { public class ReportWork : ITaskLogic {
private readonly IWorkStorage _storage; private readonly IWorkStorage _storage;
@ -18,7 +18,7 @@ namespace ServiceSourceBusinessLogic.BusinessLogic {
_storage = storage; _storage = storage;
} }
public List<ReportWorkViewModel> GetWorks(ReportWorkBindingModel model) { public List<ReportWorkViewModel> GetWorks(TaskBindingModel model) {
return _storage.GetFilteredList(new WorkSearchModel { return _storage.GetFilteredList(new WorkSearchModel {
Date = model.Date Date = model.Date
}).Select(x => new ReportWorkViewModel { }).Select(x => new ReportWorkViewModel {

View File

@ -3,7 +3,7 @@ using ServiceStationContracts.BindingModels;
using ServiceStationContracts.BusinessLogicContracts; using ServiceStationContracts.BusinessLogicContracts;
using ServiceStationContracts.SearchModels; using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels; using ServiceStationContracts.ViewModels;
using ServiceStationDataModels; using ServiceStationDataModels.Enums;
using ServiceStationsContracts.StorageContracts; using ServiceStationsContracts.StorageContracts;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -11,7 +11,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ServiceSourceBusinessLogic.BusinessLogic { namespace ServiceSourceBusinessLogic.BusinessLogic
{
public class WorkLogic : IWorkLogic { public class WorkLogic : IWorkLogic {
private readonly ILogger _logger; private readonly ILogger _logger;

View File

@ -1,14 +0,0 @@

using ServiceStationDataModels;
namespace ServiceStationContracts.BindingModels
{
public class CategoryWorkBindingModel : ICategoryWorkModel
{
public string Name { get; set; } = string.Empty;
public int ExecutorId { get; set; }
public int ID { get; set; }
}
}

View File

@ -1,25 +1,16 @@
 using ServiceStationDataModels.Models;
using ServiceStationDataModels;
namespace ServiceStationContracts.BindingModels namespace ServiceStationContracts.BindingModels
{ {
public class ClientBindingModel : IClientModel public class ClientBindingModel : IClientModel
{ {
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty; public string FIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty; public int Points { get; set; }
public string Login { get; set; } = string.Empty; public int Id { get; set; }
public int Point { get; set; }
public int ID { get; set; }
} }
} }

View File

@ -1,4 +1,4 @@
using ServiceStationDataModels; using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels namespace ServiceStationContracts.BindingModels
{ {

View File

@ -1,23 +1,13 @@
 using ServiceStationDataModels.Models;
using ServiceStationDataModels;
namespace ServiceStationContracts.BindingModels namespace ServiceStationContracts.BindingModels
{ {
public class ExecutorBindingModel : IExecutorModel public class ExecutorBindingModel : IExecutorModel
{ {
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty; public int Id { get; set; }
public string Login { get; set; } = string.Empty;
public int ID { get; set; }
} }
} }

View File

@ -1,11 +0,0 @@
using ServiceStationDataModels;
namespace ServiceStationContracts.BindingModels
{
public class ReportBindingModel : IReportModel
{
public int Count { get; set; }
public int ID { get; set; }
}
}

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationContracts.BindingModels {
public class ReportWorkBindingModel {
public string FileName { get; set; } = string.Empty;
public DateTime? Date { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using ServiceStationDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationContracts.BindingModels {
public class TaskBindingModel : ITaskModel {
public string Name { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using ServiceStationDataModels; using ServiceStationDataModels.Enums;
using ServiceStationDataModels.Models;
namespace ServiceStationContracts.BindingModels namespace ServiceStationContracts.BindingModels
{ {
@ -6,16 +7,14 @@ namespace ServiceStationContracts.BindingModels
{ {
public DateTime Date { get; set; } = DateTime.Now; public DateTime Date { get; set; } = DateTime.Now;
public int Price { get; set; } public double Price { get; set; }
public WorkStatus Status { get; set; } = WorkStatus.Неизвестно; public WorkStatus Status { get; set; } = WorkStatus.Ожидает_выполнения;
public int ExecutorId { get; set; } public int ExecutorId { get; set; }
public int ReportId { get; set; } public int TaskId { get; set; }
public int CategoryWorkId { get; set; } public int Id { get; set; }
public int ID { get; set; }
} }
} }

View File

@ -1,14 +0,0 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicContracts
{
public interface ICategoryWorkLogic
{
List<CategoryWorkViewModel>? ReadList(CategoryWorkSearchModel? model);
bool Create(CategoryWorkBindingModel model);
bool Update(CategoryWorkBindingModel model);
bool Delete(CategoryWorkBindingModel model);
}
}

View File

@ -1,14 +0,0 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
namespace ServiceStationContracts.BusinessLogicContracts
{
public interface IReportLogic
{
List<ReportViewModel>? ReadList(ReportSearchModel model);
bool Create(ReportBindingModel model);
bool Update(ReportBindingModel model);
bool Delete(ReportBindingModel model);
}
}

View File

@ -1,14 +0,0 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationContracts.BusinessLogicContracts {
public interface IReportWorkLogic {
// Получение списка заказов за определенный период
List<ReportWorkViewModel> GetWorks(ReportWorkBindingModel model);
}
}

View File

@ -0,0 +1,18 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationContracts.BusinessLogicContracts {
public interface ITaskLogic {
List<TaskViewModel>? ReadList(TaskSearchModel? model = null);
TaskViewModel? ReadElement(TaskSearchModel model);
bool Create(TaskBindingModel model);
bool Update(TaskBindingModel model);
bool Delete(TaskBindingModel model);
}
}

View File

@ -4,8 +4,7 @@
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? LastName { get; set; } public string? FIO { get; set; }
public string? Email { get; set; }
} }
} }

View File

@ -4,8 +4,6 @@
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? LastName { get; set; }
public string? Email { get; set; } public string? Email { get; set; }
} }
} }

View File

@ -1,7 +0,0 @@
namespace ServiceStationContracts.SearchModels
{
public class ReportSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -1,8 +1,9 @@
namespace ServiceStationContracts.SearchModels namespace ServiceStationContracts.SearchModels
{ {
public class CategoryWorkSearchModel public class TaskSearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? Name { get; set; } public string? Name { get; set; }
} }
} }

View File

@ -1,4 +1,4 @@
using ServiceStationDataModels; using ServiceStationDataModels.Enums;
namespace ServiceStationContracts.SearchModels namespace ServiceStationContracts.SearchModels
{ {

View File

@ -1,21 +0,0 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface ICategoryWorkStorage
{
List<CategoryWorkViewModel> GetFullList();
List<CategoryWorkViewModel> GetFilteredList(CategoryWorkSearchModel model);
CategoryWorkViewModel? GetElement(CategoryWorkSearchModel model);
CategoryWorkViewModel? Insert(CategoryWorkBindingModel model);
CategoryWorkViewModel? Update(CategoryWorkBindingModel model);
CategoryWorkViewModel? Delete(CategoryWorkBindingModel model);
}
}

View File

@ -1,21 +0,0 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface IReportStorage
{
List<ReportViewModel> GetFullList();
List<ReportViewModel> GetFilteredList(ReportSearchModel model);
ReportViewModel? GetElement(ReportSearchModel model);
ReportViewModel? Insert(ReportBindingModel model);
ReportViewModel? Update(ReportBindingModel model);
ReportViewModel? Delete(ReportBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using ServiceStationContracts.BindingModels;
using ServiceStationContracts.SearchModels;
using ServiceStationContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationsContracts.StorageContracts
{
public interface ITaskStorage
{
List<TaskViewModel> GetFullList();
List<TaskViewModel> GetFilteredList(TaskSearchModel model);
TaskViewModel? GetElement(TaskSearchModel model);
TaskViewModel? Insert(TaskBindingModel model);
TaskViewModel? Update(TaskBindingModel model);
TaskViewModel? Delete(TaskBindingModel model);
}
}

View File

@ -1,15 +0,0 @@
using ServiceStationDataModels;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class CategoryWorkViewModel : ICategoryWorkModel
{
[DisplayName("Название категории работ")]
public string Name { get; set; } = string.Empty;
public int ExecutorId { get; set; }
public int ID { get; set; }
}
}

View File

@ -1,25 +1,19 @@
using ServiceStationDataModels; using ServiceStationDataModels.Models;
using System.ComponentModel; using System.ComponentModel;
namespace ServiceStationContracts.ViewModels namespace ServiceStationContracts.ViewModels
{ {
public class ClientViewModel : IClientModel public class ClientViewModel : IClientModel
{ {
[DisplayName("Имя")] [DisplayName("ФИО")]
public string FirstName { get; set; } = string.Empty; public string FIO { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string LastName { get; set; } = string.Empty;
[DisplayName("Email")]
public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")] [DisplayName("Пароль")]
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
[DisplayName("Телефон")]
public string PhoneNumber { get; set; } = string.Empty;
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Бонусы")]
public int Point { get; set; }
public int ID { get; set; } [DisplayName("Бонусы")]
public int Points { get; set; }
public int Id { get; set; }
} }
} }

View File

@ -1,4 +1,4 @@
using ServiceStationDataModels; using ServiceStationDataModels.Models;
namespace ServiceStationContracts.ViewModels namespace ServiceStationContracts.ViewModels

View File

@ -1,22 +1,15 @@
using ServiceStationDataModels; using ServiceStationDataModels.Models;
using System.ComponentModel; using System.ComponentModel;
namespace ServiceStationContracts.ViewModels namespace ServiceStationContracts.ViewModels
{ {
public class ExecutorViewModel : IExecutorModel public class ExecutorViewModel : IExecutorModel
{ {
[DisplayName("Имя")]
public string FirstName { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string LastName { get; set; } = string.Empty;
[DisplayName("Email")] [DisplayName("Email")]
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")] [DisplayName("Пароль")]
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
[DisplayName("Телефон")]
public string PhoneNumber { get; set; } = string.Empty; public int Id { get; set; }
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
public int ID { get; set; }
} }
} }

View File

@ -1,12 +0,0 @@
using ServiceStationDataModels;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class ReportViewModel : IReportModel
{
public int Count { get; set; }
public int ID { get; set; }
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationContracts.ViewModels {
public class ReportWorkViewModel {
public int Id { get; set; }
public DateTime Date { get; set; }
public double price { get; set; }
public string WorkStatus { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,13 @@
using ServiceStationDataModels.Models;
using System.ComponentModel;
namespace ServiceStationContracts.ViewModels
{
public class TaskViewModel : ITaskModel
{
[DisplayName("Имя задачи")]
public string Name { get; set; }
public int Id { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using ServiceStationDataModels; using ServiceStationDataModels.Enums;
using ServiceStationDataModels.Models;
using System.ComponentModel; using System.ComponentModel;
@ -9,17 +10,15 @@ namespace ServiceStationContracts.ViewModels
[DisplayName("Дата")] [DisplayName("Дата")]
public DateTime Date { get; set; } = DateTime.Now; public DateTime Date { get; set; } = DateTime.Now;
[DisplayName("Цена")] [DisplayName("Цена")]
public int Price { get; set; } public double Price { get; set; }
[DisplayName("Статус")] [DisplayName("Статус")]
public WorkStatus Status { get; set; } = WorkStatus.Неизвестно; public WorkStatus Status { get; set; } = WorkStatus.Ожидает_выполнения;
public int ExecutorId { get; set; } public int ExecutorId { get; set; }
public int ReportId { get; set; } public int TaskId { get; set; }
public int CategoryWorkId { get; set; } public int Id { get; set; }
public int ID { get; set; }
public Dictionary<int, (ICategoryWorkModel, int)> CategoryWorkList { get; set; } = new();
} }
} }

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationDataModels.Enums
{
public enum WorkStatus
{
Ожидает_выполнения = -1,
Выполняется = 1
}
}

View File

@ -1,15 +0,0 @@
using ServiceStationDataModels.HelperInterfaces;
namespace ServiceStationDataModels
{
public interface IClientModel : IId
{
string FirstName { get; }
string LastName { get; }
string Email { get; }
string Password { get; }
string PhoneNumber { get; }
string Login { get; }
int Point { get; }
}
}

View File

@ -2,6 +2,6 @@
{ {
public interface IId public interface IId
{ {
int ID { get; } int Id { get; }
} }
} }

View File

@ -1,14 +0,0 @@
using ServiceStationDataModels.HelperInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationDataModels
{
public interface IReportModel : IId
{
int Count { get; }
}
}

View File

@ -0,0 +1,11 @@
using ServiceStationDataModels.HelperInterfaces;
namespace ServiceStationDataModels.Models
{
public interface IClientModel : IId
{
string FIO { get; }
string Password { get; }
int Points { get; }
}
}

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ServiceStationDataModels namespace ServiceStationDataModels.Models
{ {
public interface IClientWorkModel public interface IClientWorkModel
{ {

View File

@ -5,15 +5,11 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ServiceStationDataModels namespace ServiceStationDataModels.Models
{ {
public interface IExecutorModel : IId public interface IExecutorModel : IId
{ {
string FirstName { get; }
string LastName { get; }
string Email { get; } string Email { get; }
string Password { get; } string Password { get; }
string PhoneNumber { get; }
string Login { get; }
} }
} }

View File

@ -5,11 +5,10 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ServiceStationDataModels namespace ServiceStationDataModels.Models
{ {
public interface ICategoryWorkModel: IId public interface ITaskModel : IId
{ {
string Name { get; } string Name { get; }
int ExecutorId { get; }
} }
} }

View File

@ -1,19 +1,19 @@
using ServiceStationDataModels.HelperInterfaces; using ServiceStationDataModels.Enums;
using ServiceStationDataModels.HelperInterfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ServiceStationDataModels namespace ServiceStationDataModels.Models
{ {
public interface IWorkModel : IId public interface IWorkModel : IId
{ {
DateTime Date { get; } DateTime Date { get; }
int Price { get; } double Price { get; }
WorkStatus Status { get; } WorkStatus Status { get; }
int ExecutorId { get; } int ExecutorId { get; }
int ReportId { get; } int TaskId { get; }
int CategoryWorkId { get; }
} }
} }

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceStationDataModels
{
public enum WorkStatus
{
Неизвестно = -1,
Принят = 0,
Выполняется = 1,
Готов = 2,
Выдан = 3
}
}

View File

@ -11,12 +11,12 @@ using System.Threading.Tasks;
namespace ServiceStationsDataBaseImplement.Implements namespace ServiceStationsDataBaseImplement.Implements
{ {
public class ReportStorage : IReportStorage public class ReportStorage : ITaskStorage
{ {
public ReportViewModel? Delete(ReportBindingModel model) public TaskViewModel? Delete(ReportBindingModel model)
{ {
using var context = new Database(); using var context = new Database();
var element = context.Reports.FirstOrDefault(rec => rec.Id == model.ID); var element = context.Reports.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null) if (element != null)
{ {
context.Reports.Remove(element); context.Reports.Remove(element);
@ -26,7 +26,7 @@ namespace ServiceStationsDataBaseImplement.Implements
return null; return null;
} }
public ReportViewModel? GetElement(ReportSearchModel model) public TaskViewModel? GetElement(TaskSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue)
{ {
@ -37,7 +37,7 @@ namespace ServiceStationsDataBaseImplement.Implements
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel; (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
} }
public List<ReportViewModel> GetFilteredList(ReportSearchModel model) public List<TaskViewModel> GetFilteredList(TaskSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue)
{ {
@ -47,13 +47,13 @@ namespace ServiceStationsDataBaseImplement.Implements
return context.Reports.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList(); return context.Reports.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
} }
public List<ReportViewModel> GetFullList() public List<TaskViewModel> GetFullList()
{ {
using var context = new Database(); using var context = new Database();
return context.Reports.Select(x => x.GetViewModel).ToList(); return context.Reports.Select(x => x.GetViewModel).ToList();
} }
public ReportViewModel? Insert(ReportBindingModel model) public TaskViewModel? Insert(ReportBindingModel model)
{ {
var newComponent = Report.Create(model); var newComponent = Report.Create(model);
if (newComponent == null) if (newComponent == null)
@ -66,10 +66,10 @@ namespace ServiceStationsDataBaseImplement.Implements
return newComponent.GetViewModel; return newComponent.GetViewModel;
} }
public ReportViewModel? Update(ReportBindingModel model) public TaskViewModel? Update(ReportBindingModel model)
{ {
using var context = new Database(); using var context = new Database();
var component = context.Reports.FirstOrDefault(x => x.Id == model.ID); var component = context.Reports.FirstOrDefault(x => x.Id == model.Id);
if (component == null) if (component == null)
{ {
return null; return null;

View File

@ -1,6 +1,6 @@
using ServiceStationContracts.BindingModels; using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels; using ServiceStationContracts.ViewModels;
using ServiceStationDataModels; using ServiceStationDataModels.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;

View File

@ -1,6 +1,6 @@
using ServiceStationContracts.BindingModels; using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels; using ServiceStationContracts.ViewModels;
using ServiceStationDataModels; using ServiceStationDataModels.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;

View File

@ -1,6 +1,6 @@
using ServiceStationContracts.BindingModels; using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels; using ServiceStationContracts.ViewModels;
using ServiceStationDataModels; using ServiceStationDataModels.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -25,7 +25,7 @@ namespace ServiceStationsDataBaseImplement.Models
[Required] [Required]
public string Login { get; set; } = string.Empty; public string Login { get; set; } = string.Empty;
[Required] [Required]
public int ID { get; set; } public int Id { get; set; }
public static Executor? Create(ExecutorBindingModel? model) public static Executor? Create(ExecutorBindingModel? model)
{ {
if (model == null) if (model == null)
@ -40,7 +40,7 @@ namespace ServiceStationsDataBaseImplement.Models
Password = model.Password, Password = model.Password,
PhoneNumber = model.PhoneNumber, PhoneNumber = model.PhoneNumber,
Login = model.Login, Login = model.Login,
ID = model.ID Id = model.Id
}; };
} }
@ -54,7 +54,7 @@ namespace ServiceStationsDataBaseImplement.Models
Password = model.Password, Password = model.Password,
PhoneNumber = model.PhoneNumber, PhoneNumber = model.PhoneNumber,
Login = model.Login, Login = model.Login,
ID = model.ID Id = model.Id
}; };
} }
public void Update(ExecutorBindingModel model) public void Update(ExecutorBindingModel model)
@ -79,7 +79,7 @@ namespace ServiceStationsDataBaseImplement.Models
Password = Password, Password = Password,
PhoneNumber = PhoneNumber, PhoneNumber = PhoneNumber,
Login = Login, Login = Login,
ID = ID Id = Id
}; };
} }
} }

View File

@ -1,6 +1,6 @@
using ServiceStationContracts.BindingModels; using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels; using ServiceStationContracts.ViewModels;
using ServiceStationDataModels; using ServiceStationDataModels.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -10,12 +10,12 @@ using System.Threading.Tasks;
namespace ServiceStationsDataBaseImplement.Models namespace ServiceStationsDataBaseImplement.Models
{ {
public class Report : IReportModel public class Report : ITaskModel
{ {
[Required] [Required]
public int Count { get; set; } public int Count { get; set; }
public int ID { get; set; } public int Id { get; set; }
public static Report? Create(ReportBindingModel? model) public static Report? Create(ReportBindingModel? model)
{ {
if (model == null) if (model == null)
@ -24,15 +24,15 @@ namespace ServiceStationsDataBaseImplement.Models
} }
return new Report() return new Report()
{ {
ID = model.ID, Id = model.Id,
Count = model.Count Count = model.Count
}; };
} }
public static Report? Create(ReportViewModel model) public static Report? Create(TaskViewModel model)
{ {
return new Report return new Report
{ {
ID = model.ID, Id = model.Id,
Count = model.Count, Count = model.Count,
}; };
} }
@ -45,9 +45,9 @@ namespace ServiceStationsDataBaseImplement.Models
Count = model.Count; Count = model.Count;
} }
public ReportViewModel GetViewModel => new() public TaskViewModel GetViewModel => new()
{ {
ID = ID, Id = Id,
Count = Count Count = Count
}; };
} }

View File

@ -1,6 +1,7 @@
using ServiceStationContracts.BindingModels; using ServiceStationContracts.BindingModels;
using ServiceStationContracts.ViewModels; using ServiceStationContracts.ViewModels;
using ServiceStationDataModels; using ServiceStationDataModels.Enums;
using ServiceStationDataModels.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -22,7 +23,7 @@ namespace ServiceStationsDataBaseImplement.Models
public int CategoryWorkId { get; set; } public int CategoryWorkId { get; set; }
public int ID { get; set; } public int Id { get; set; }
public static Work? Create(WorkBindingModel? model) public static Work? Create(WorkBindingModel? model)
{ {
if (model == null) if (model == null)
@ -37,7 +38,7 @@ namespace ServiceStationsDataBaseImplement.Models
ExecutorId = model.ExecutorId, ExecutorId = model.ExecutorId,
ReportId = model.ReportId, ReportId = model.ReportId,
CategoryWorkId = model.CategoryWorkId, CategoryWorkId = model.CategoryWorkId,
ID = model.ID Id = model.Id
}; };
@ -52,7 +53,7 @@ namespace ServiceStationsDataBaseImplement.Models
ExecutorId = model.ExecutorId, ExecutorId = model.ExecutorId,
ReportId = model.ReportId, ReportId = model.ReportId,
CategoryWorkId = model.CategoryWorkId, CategoryWorkId = model.CategoryWorkId,
ID = model.ID Id = model.Id
}; };
} }
public void Update(WorkBindingModel model) public void Update(WorkBindingModel model)
@ -78,7 +79,7 @@ namespace ServiceStationsDataBaseImplement.Models
ExecutorId = ExecutorId, ExecutorId = ExecutorId,
ReportId = ReportId, ReportId = ReportId,
CategoryWorkId = CategoryWorkId, CategoryWorkId = CategoryWorkId,
ID = ID Id = Id
}; };
} }
} }