Ejemplo n.º 1
0
        public async Task <ActionResult> AddRole(Models.ManageUserViewModels.UserRoleConfirmAction model)
        {
            try
            {
                // TODO: Add update logic here
                if (Request.Form["Confirm"].ToString() == "Confirm")
                {
                    await _userRoleService.AddUserToRole(model.LoginName, model.SelectedRole);

                    return(RedirectToAction("UserRoleEdit", "ManageUser", new { id = model.UserID }));
                }
                else
                {
                    return(RedirectToAction("UserList", "ManageUser"));
                }
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 2
0
        ///{UserID}/{SelectedRole}")]
        public async Task <ActionResult> DeleteRole([FromBody] Models.ManageUserViewModels.UserRoleConfirmAction model)
        {
            try
            {
                // TODO: Add update logic here
                //if (Request.Form["Confirm"].ToString() == "Confirm")
                //{
                await _userRoleService.DeleteUserFromRole(model.LoginName, model.SelectedRole);

                return(Ok());
                //return RedirectToAction("UserRoleEdit", new { id = model.UserID });
                //}
                //else
                //    return RedirectToAction("UserList", "ManageUser");
            }
            catch
            {
                return(BadRequest());
                //return RedirectToAction("Index", "Home");
            }
        }