Sergey Kozyrev
1a18c24f37
Work it harder, make it better Do it faster, makes us stronger More than ever, hour after hour Work is never over
228 lines
6.2 KiB
C#
228 lines
6.2 KiB
C#
using Contracts.BusinessLogicsContracts;
|
||
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()
|
||
{
|
||
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);
|
||
}
|
||
public IActionResult CreateMachine()
|
||
{
|
||
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);
|
||
}
|
||
public IActionResult IndexWorker()
|
||
{
|
||
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);
|
||
}
|
||
public IActionResult CreateWorker()
|
||
{
|
||
return View();
|
||
}
|
||
public IActionResult IndexWorkshop()
|
||
{
|
||
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);
|
||
}
|
||
public IActionResult CreateWorkshop()
|
||
{
|
||
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);
|
||
}
|
||
public IActionResult Privacy()
|
||
{
|
||
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()
|
||
{
|
||
return View();
|
||
}
|
||
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);
|
||
}
|
||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||
public IActionResult Error()
|
||
{
|
||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||
}
|
||
}
|
||
} |