Coursach/Course/ImplementerApp/Controllers/HomeController.cs
Sergey Kozyrev 1a18c24f37 SomeWorkshopReportImplementer
Work it harder, make it better
Do it faster, makes us stronger
More than ever, hour after hour
Work is never over
2024-04-30 22:06:53 +04:00

226 lines
6.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using ImplementerApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using BusinessLogic.BusinessLogic;
using Contracts.BusinessLogicsContracts;
using Contracts.ViewModels;
using DataModels.Models;
namespace ImplementerApp.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IDetailLogic _detailLogic;
private readonly IImplementerLogic _userLogic;
private readonly IProductLogic _productLogic;
private readonly IProductionLogic _productionLogic;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
public IActionResult Enter()
{
return View();
}
public IActionResult Register()
{
return View();
}
public IActionResult IndexDetail()
{
var details = new List<DetailViewModel>();
details.Add(new DetailViewModel
{
Id = 1,
Name = "Test",
Cost = 55.5,
UserId = 1
});
details.Add(new DetailViewModel
{
Id = 2,
Name = "Test1",
Cost = 32,
UserId = 2
});
return View(details);
}
public IActionResult CreateDetail()
{
return View();
}
public IActionResult IndexProduct()
{
List<ProductViewModel> products = new List<ProductViewModel>
{
new ProductViewModel
{
Id = 1,
Name = "Изделие 1",
Cost = 10.99,
UserId = 1,
MachineId = 1
},
new ProductViewModel
{
Id = 2,
Name = "Изделие 2",
Cost = 19.99,
UserId = 2,
MachineId = 2
}
};
return View(products);
}
public IActionResult CreateProduct()
{
var details = new List<DetailViewModel>();
details.Add(new DetailViewModel
{
Id = 1,
Name = "Test",
Cost = 55.5,
UserId = 1
});
details.Add(new DetailViewModel
{
Id = 2,
Name = "Test1",
Cost = 32,
UserId = 2
});
return View(details);
}
public IActionResult IndexProduction()
{
List<ProductionViewModel> productionViewModels = new List<ProductionViewModel>
{
new ProductionViewModel
{
Id = 1,
Name = "Производство А",
Cost = 1000.00,
UserId = 1
},
new ProductionViewModel
{
Id = 2,
Name = "Производство Б",
Cost = 1500.00,
UserId = 2
}
};
return View(productionViewModels);
}
public IActionResult CreateProduction()
{
var details = new List<DetailViewModel>();
details.Add(new DetailViewModel
{
Id = 1,
Name = "Test",
Cost = 55.5,
UserId = 1
});
details.Add(new DetailViewModel
{
Id = 2,
Name = "Test1",
Cost = 32,
UserId = 2
});
return View(details);
}
public IActionResult Privacy()
{
ImplementerViewModel user = new()
{
Email = "mail@mail.ru",
Login = "Login",
Password = "password",
Name = "User"
};
return View(user);
}
public IActionResult DetailTimeReport()
{
List<DetailTimeReport> detailTimeReports = new List<DetailTimeReport>
{
new DetailTimeReport
{
DetailName = "Деталь А",
Productions = new List<string> { "Производство 1", "Производство 2" },
Products = new List<string> { "Машина X", "Машина Y" }
},
new DetailTimeReport
{
DetailName = "Деталь B",
Productions = new List<string> { "Производство 3", "Производство 4" },
Products = new List<string> { "Машина Z", "Машина W" }
}
};
return View(detailTimeReports);
}
public IActionResult DetailWorkshopReport()
{
List<DetailWorkshopReportViewModel> detailWorkshopReports = new List<DetailWorkshopReportViewModel>
{
new DetailWorkshopReportViewModel
{
DetailName = "Деталь X",
WorkShops = new List<string> { "Цех 1", "Цех 2" }
},
new DetailWorkshopReportViewModel
{
DetailName = "Деталь Y",
WorkShops = new List<string> { "Цех 3", "Цех 4" }
}
};
return View(detailWorkshopReports);
}
public IActionResult ReportsMenu()
{
return View();
}
public IActionResult ProductMachineAdd()
{
List<MachineViewModel> machines = new List<MachineViewModel>
{
new MachineViewModel
{
Id = 1,
Title = "Токарный станок",
Country = "Германия",
UserId = 1,
WorkerMachines = new()
},
new MachineViewModel
{
Id = 2,
Title = "Фрезерный станок",
Country = "Япония",
UserId = 2,
WorkerMachines = new()
}
};
return View(machines);
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}