/Source/Samples/Blog/Bifrost.Samples.Blog.Mvc/Areas/Administration/Features/Users/UsersController.cs
C# | 40 lines | 32 code | 8 blank | 0 comment | 0 complexity | 3cadc8b3b825a30618e56fa517338ae8 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
- using System.Web.Mvc;
- using Bifrost.Commands;
- using Bifrost.Samples.Blog.Application.Security;
- using Bifrost.Samples.Blog.Domain.Security.Commands;
-
- namespace Bifrost.Samples.Blog.Mvc.Areas.Administration.Features.Users
- {
- public class UsersController : AdministrationController
- {
- readonly IAuthenticationService _authenticationService;
- readonly ICommandCoordinator _commandCoordinator;
-
- public UsersController(IAuthenticationService authenticationService, ICommandCoordinator commandCoordinator)
- {
- _authenticationService = authenticationService;
- _commandCoordinator = commandCoordinator;
- }
-
- public ActionResult Index()
- {
- var users = _authenticationService.GetAllUsers();
- return View(users);
- }
-
-
- public ActionResult Create(CreateUser createUser)
- {
- _commandCoordinator.Handle(createUser);
- return RedirectToAction("Show",new {userName=createUser.Name} );
- }
-
-
- public ActionResult Show(string userName)
- {
- var user = _authenticationService.GetUserByName(userName);
- return View(user);
- }
-
- }
- }