You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. using Microsoft.AspNet.Identity.EntityFramework;
  2. using Sevomin.Models;
  3. using Sevomin.Models.Helpers;
  4. using System.Threading.Tasks;
  5. using System.Web.Mvc;
  6. namespace Sevomin.WebFrontend.Controllers
  7. {
  8. public class HomeController : BaseController
  9. {
  10. public HomeController()
  11. : this(new SevominUserManager(new UserStore<User>(SevominDbContext.Current)))
  12. {
  13. }
  14. public HomeController(SevominUserManager userManager)
  15. {
  16. UserManager = userManager;
  17. }
  18. public SevominUserManager UserManager { get; private set; }
  19. public async Task<ActionResult> Index()
  20. {
  21. if (!Request.IsAuthenticated)
  22. return View("Intro");
  23. else
  24. {
  25. User user = await UserManager.FindByNameAsync(User.Identity.Name);
  26. if (user is Avalin)
  27. return View("AvalinIndex");
  28. else if (user is Dovomin)
  29. return View("DovominIndex");
  30. else
  31. return RedirectToAction("Index", "God");
  32. }
  33. }
  34. }
  35. }