public ActionResult Users_Destroy([DataSourceRequest]DataSourceRequest request, UsersAdminViewModel user)
        {
            if (this.ModelState.IsValid)
            {
                this.userServices.Delete(user.Id);
            }

            return this.Json(new[] { user }.ToDataSourceResult(request, this.ModelState));
        }
        public ActionResult Users_Update([DataSourceRequest]DataSourceRequest request, UsersAdminViewModel user)
        {
            if (this.ModelState.IsValid)
            {
                var dbUser = this.userServices.Edit(user.Id, user.Email, user.FirstName, user.LastName);
            }

            return this.Json(new[] { user }.ToDataSourceResult(request, this.ModelState));
        }
        public ActionResult Users_CreateAdmin([DataSourceRequest]DataSourceRequest request, UsersAdminViewModel user)
        {
            if (this.ModelState.IsValid)
            {
                var dbUser = this.userServices.CreateAdmin(user.Username, user.Email, user.Password, user.FirstName, user.LastName);
                user.Id = dbUser.Id;
            }

            return this.Json(new[] { user }.ToDataSourceResult(request, this.ModelState));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Index()
        {
            var users = userManager.Users.ToList();

            users.Sort(new EUser.CompareByFIO());
            var model = new UsersAdminViewModel(database)
            {
                Users      = users,
                WhyTitles  = new Dictionary <EUser, string>(),
                userGrants = await checkService.getUserGrants(User)
            };

            return(View(model));
        }