public JsonResult GetRoles() { var roles = _rolesRepository.GetRoles(); return(new JsonResult { Data = roles, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public async Task <ActionResult <IEnumerable <RoleModel> > > Get() { var roles = await Task.FromResult(_rolesRepository.GetRoles()); if (roles.Select(Mappers.RoleModelMapper.Map) is IEnumerable <RoleModel> modelRoles) { return(Ok(modelRoles)); } return(NotFound()); }
public async Task <IActionResult> GetRoles() { try { List <RoleViewModel> roles = await _rolesRepository.GetRoles(); return(Ok(roles)); } catch (Exception x) { return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public async Task <IActionResult> GetRoles() { try { var roles = await roleRepository.GetRoles(); if (roles == null) { return(NotFound()); } return(Ok(roles)); } catch (Exception) { return(BadRequest()); } }
public async Task <IActionResult> GetRoles() { var roles = await _rolesRepository.GetRoles(); var rolePermissions = await _rolesPermissionRepository.GetAll(); var permissions = await _permissionRepository.GetAll(); var rolesToReturn = new List <Object>(); foreach (Roles role in roles) { var rolePermission = rolePermissions.Where(rp => rp.Role.Id == role.Id).Select(rp => rp.Permission); rolesToReturn.Add(new { id = role.Id, name = role.Name, permissions = rolePermission }); } return(Ok(new { roles = rolesToReturn, permissions })); }
public List <Rol> GetRoles() { return(_rolesRepository.GetRoles()); }
public async Task <IActionResult> GetRoles() { var roles = await _rolesRepository.GetRoles(); return(Ok(new { roles })); }
public AutoSolutionPageSet <RolesViewModel> GetRoles(RolesViewModel rolesViewModel) { return(rolesRepository.GetRoles(rolesViewModel)); }
public IQueryable <Roles> Get() { return(_context.GetRoles()); }
public IEnumerable <RolesViewModel> GetAll() { return(_iRolesRepository.GetRoles().UseAsDataSource(Mapper.Configuration).For <RolesViewModel>()); }