source: Application/ocrent/Controllers/AdministratorController.cs@ f5f7c24

Last change on this file since f5f7c24 was f5f7c24, checked in by 192011 <mk.snicker@…>, 17 months ago

Initial commit

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[f5f7c24]1using Dal.ApplicationStorage.DataAccess.Abstract;
2using Microsoft.AspNetCore.Mvc;
3using Models.DataTransferObjects.Administrator;
4
5namespace ocrent.Controllers
6{
7 public class AdministratorController : Controller
8 {
9 private readonly IAdministrator _administratorDa;
10 private readonly ICompanyDa _companyDa;
11
12
13 public AdministratorController(IAdministrator administratorDa,ICompanyDa companyDa)
14 {
15 _administratorDa = administratorDa;
16 _companyDa = companyDa;
17 }
18 public async Task<IActionResult> Companies()
19 {
20 var companies = await _administratorDa.GetAllCompanies();
21 return View(companies);
22 }
23
24 public async Task<IActionResult> ApproveCompany(int companyId)
25 {
26 var company = await _companyDa.GetCompany(companyId);
27 //var administratorId = HttpContext.Session.GetString("userId");
28 //await _administratorDa.ApproveCompany(companyId, Int32.Parse(administratorId));
29
30 return View(company);
31 }
32
33 [HttpPost]
34 public async Task<IActionResult> ApproveCompany(AdministratorCompaniesDTO dto)
35 {
36 var administratorId = HttpContext.Session.GetString("userId");
37 await _administratorDa.ApproveCompany(dto.CompanyId, Int32.Parse(administratorId));
38
39 return RedirectToAction("Companies", "Administrator");
40 }
41 }
42}
Note: See TracBrowser for help on using the repository browser.