HomeController.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using GreenTree.Nachtragsmanagement.Services.Configuration;
  7. using GreenTree.Nachtragsmanagement.Services.Test;
  8. using GreenTree.Nachtragsmanagement.Services.User;
  9. using GreenTree.Nachtragsmanagement.Web.Framework;
  10. using GreenTree.Nachtragsmanagement.Web.Models.Test;
  11. using GreenTree.Nachtragsmanagement.Web.Models.User;
  12. using Newtonsoft.Json;
  13. namespace GreenTree.Nachtragsmanagement.Web.Controllers
  14. {
  15. public class HomeController : Controller
  16. {
  17. private readonly IDbRelationService _dbRelationService;
  18. private readonly IConfigurationService _configurationService;
  19. private readonly IUserService _userService;
  20. public HomeController(
  21. IDbRelationService dbRelationService,
  22. IConfigurationService configurationService,
  23. IUserService userService)
  24. {
  25. _dbRelationService = dbRelationService;
  26. _configurationService = configurationService;
  27. _userService = userService;
  28. }
  29. // GET: Home
  30. public ActionResult Index()
  31. {
  32. var users = _userService.GetAllUsers();
  33. var relations = _dbRelationService.GetRelations(3, DbRelationFormat.Json);
  34. var model = new DbRelationModel
  35. {
  36. UserJson = relations[0],
  37. DeviationJson = relations[1],
  38. SiteJson = relations[2],
  39. AppendixJson = relations[3]
  40. };
  41. var configSection = _configurationService.GetCurrentConfiguration();
  42. return View("~/Views/Home/Index.cshtml", model);
  43. }
  44. }
  45. }