2024-04-30 22:06:53 +04:00
|
|
|
|
using Contracts.BusinessLogicsContracts;
|
2024-04-30 00:42:26 +04:00
|
|
|
|
using Contracts.ViewModels;
|
|
|
|
|
using GuarantorAPP.Models;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
namespace GuarantorAPP.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger<HomeController> _logger;
|
|
|
|
|
private readonly IGuarantorLogic _userLogic;
|
|
|
|
|
private readonly IMachineLogic _machineLogic;
|
|
|
|
|
private readonly IWorkerLogic _workerLogic;
|
|
|
|
|
private readonly IWorkshopLogic _workshopLogic;
|
|
|
|
|
|
|
|
|
|
public HomeController(ILogger<HomeController> logger)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
public IActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
public IActionResult Enter()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
public IActionResult Register()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
public IActionResult IndexMachine()
|
|
|
|
|
{
|
2024-04-30 21:51:55 +04:00
|
|
|
|
List<MachineViewModel> machines = new List<MachineViewModel>
|
|
|
|
|
{
|
|
|
|
|
new MachineViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 1,
|
|
|
|
|
Title = "Токарный станок",
|
|
|
|
|
Country = "Китай",
|
|
|
|
|
UserId = 1
|
|
|
|
|
},
|
|
|
|
|
new MachineViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 2,
|
|
|
|
|
Title = "Фрезерный станок",
|
|
|
|
|
Country = "Россия",
|
|
|
|
|
UserId = 2
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return View(machines);
|
2024-04-30 00:42:26 +04:00
|
|
|
|
}
|
|
|
|
|
public IActionResult CreateMachine()
|
|
|
|
|
{
|
2024-04-30 21:51:55 +04:00
|
|
|
|
var workers = new List<WorkerViewModel>();
|
|
|
|
|
workers.Add(new WorkerViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 1,
|
|
|
|
|
Name = "Фролов Феодосий Валерьевич",
|
|
|
|
|
Birthday = new DateTime(1989, 03, 29),
|
|
|
|
|
Specialization = "Металлург",
|
|
|
|
|
Salary = 55000,
|
|
|
|
|
UserId = 1
|
|
|
|
|
});
|
|
|
|
|
workers.Add(new WorkerViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 2,
|
|
|
|
|
Name = "Медведков Андрей Алексеевич",
|
|
|
|
|
Birthday = new DateTime(2004, 02, 29),
|
|
|
|
|
Specialization = "Слесарь",
|
|
|
|
|
Salary = 25000,
|
|
|
|
|
UserId = 2
|
|
|
|
|
});
|
|
|
|
|
return View(workers);
|
|
|
|
|
}
|
2024-04-30 00:42:26 +04:00
|
|
|
|
public IActionResult IndexWorker()
|
|
|
|
|
{
|
2024-04-30 21:51:55 +04:00
|
|
|
|
var workers = new List<WorkerViewModel>();
|
|
|
|
|
workers.Add(new WorkerViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 1,
|
|
|
|
|
Name = "Фролов Феодосий Валерьевич",
|
|
|
|
|
Birthday = new DateTime(1989, 03, 29),
|
|
|
|
|
Specialization = "Металлург",
|
|
|
|
|
Salary = 55000,
|
|
|
|
|
UserId = 1
|
|
|
|
|
});
|
|
|
|
|
workers.Add(new WorkerViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 2,
|
|
|
|
|
Name = "Медведков Андрей Алексеевич",
|
|
|
|
|
Birthday = new DateTime(2004, 02, 29),
|
|
|
|
|
Specialization = "Слесарь",
|
|
|
|
|
Salary = 25000,
|
|
|
|
|
UserId = 2
|
|
|
|
|
});
|
|
|
|
|
return View(workers);
|
2024-04-30 00:42:26 +04:00
|
|
|
|
}
|
|
|
|
|
public IActionResult CreateWorker()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
public IActionResult IndexWorkshop()
|
|
|
|
|
{
|
2024-04-30 21:51:55 +04:00
|
|
|
|
List<WorkshopViewModel> workshops = new List<WorkshopViewModel>
|
|
|
|
|
{
|
|
|
|
|
new WorkshopViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 1,
|
|
|
|
|
Title = "Механический цех",
|
|
|
|
|
Address = "Ул. Пушкина, колотушкина",
|
|
|
|
|
Director = "Главный Андрей цеха",
|
|
|
|
|
UserId = 1,
|
|
|
|
|
ProductionId = 1,
|
|
|
|
|
},
|
|
|
|
|
new WorkshopViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 2,
|
|
|
|
|
Title = "Сварочный цех",
|
|
|
|
|
Address = "Ул. Пушкина, колотушкина 22",
|
|
|
|
|
Director = "Фрезер Давыд Анатольевич",
|
|
|
|
|
UserId = 2,
|
|
|
|
|
ProductionId = 2,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return View(workshops);
|
2024-04-30 00:42:26 +04:00
|
|
|
|
}
|
|
|
|
|
public IActionResult CreateWorkshop()
|
|
|
|
|
{
|
2024-04-30 21:51:55 +04:00
|
|
|
|
var workers = new List<WorkerViewModel>();
|
|
|
|
|
workers.Add(new WorkerViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 1,
|
|
|
|
|
Name = "Фролов Феодосий Валерьевич",
|
|
|
|
|
Birthday = new DateTime(1989, 03, 29),
|
|
|
|
|
Specialization = "Металлург",
|
|
|
|
|
Salary = 55000,
|
|
|
|
|
UserId = 1
|
|
|
|
|
});
|
|
|
|
|
workers.Add(new WorkerViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 2,
|
|
|
|
|
Name = "Медведков Андрей Алексеевич",
|
|
|
|
|
Birthday = new DateTime(2004, 02, 29),
|
|
|
|
|
Specialization = "Слесарь",
|
|
|
|
|
Salary = 25000,
|
|
|
|
|
UserId = 2
|
|
|
|
|
});
|
|
|
|
|
return View(workers);
|
|
|
|
|
}
|
2024-04-30 00:42:26 +04:00
|
|
|
|
public IActionResult Privacy()
|
2024-04-30 21:51:55 +04:00
|
|
|
|
{
|
|
|
|
|
GuarantorViewModel user = new()
|
|
|
|
|
{
|
|
|
|
|
Email = "mailtatar@mail.ru",
|
|
|
|
|
Login = "tatar",
|
|
|
|
|
Password = "password",
|
|
|
|
|
Name = "User",
|
|
|
|
|
};
|
|
|
|
|
return View(user);
|
|
|
|
|
}
|
|
|
|
|
public IActionResult MachineWorkshopTimeReport()
|
|
|
|
|
{
|
|
|
|
|
List<MachineWorkshopTimeReport> machineWorkshopTimeReports = new List<MachineWorkshopTimeReport>
|
|
|
|
|
{
|
|
|
|
|
new MachineWorkshopTimeReport
|
|
|
|
|
{
|
|
|
|
|
WorkshopName = "Цех А",
|
|
|
|
|
Machines = new List<string> { "Фрезерный станок", "Токарный станок" }
|
|
|
|
|
},
|
|
|
|
|
new MachineWorkshopTimeReport
|
|
|
|
|
{
|
|
|
|
|
WorkshopName = "Цех В",
|
|
|
|
|
Machines = new List<string> { "Станок А", "Станок В" }
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return View(machineWorkshopTimeReports);
|
|
|
|
|
}
|
|
|
|
|
public IActionResult WorkerProductReport()
|
|
|
|
|
{
|
|
|
|
|
List<WorkerProductReportViewModel> workerProductReports = new List<WorkerProductReportViewModel>
|
|
|
|
|
{
|
|
|
|
|
new WorkerProductReportViewModel
|
|
|
|
|
{
|
|
|
|
|
WorkerName = "Работник 1",
|
|
|
|
|
Products = new List<string> { "Изделие первое", "Изделие второе" }
|
|
|
|
|
},
|
|
|
|
|
new WorkerProductReportViewModel
|
|
|
|
|
{
|
|
|
|
|
WorkerName = "Работник 2",
|
|
|
|
|
Products = new List<string> { "Изделие одно", "Изделие второе" }
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return View(workerProductReports);
|
|
|
|
|
}
|
|
|
|
|
public IActionResult ReportsMenu()
|
2024-04-30 00:42:26 +04:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2024-04-30 21:51:55 +04:00
|
|
|
|
public IActionResult WorkshopProductionAdd()
|
|
|
|
|
{
|
|
|
|
|
List<ProductionViewModel> production = new List<ProductionViewModel>
|
|
|
|
|
{
|
|
|
|
|
new ProductionViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 1,
|
|
|
|
|
Name = "Производство старое",
|
|
|
|
|
Cost = 1,
|
|
|
|
|
UserId = 1,
|
|
|
|
|
},
|
|
|
|
|
new ProductionViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = 2,
|
|
|
|
|
Name = "Производство новое",
|
|
|
|
|
Cost = 2,
|
|
|
|
|
UserId = 2,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return View(production);
|
|
|
|
|
}
|
2024-04-30 00:42:26 +04:00
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
|
public IActionResult Error()
|
|
|
|
|
{
|
|
|
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|