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.

37 lines
1.1 KiB

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
  29. return View("DovominIndex");
  30. }
  31. }
  32. }
  33. }