public GetPermissionResponse GetPermission([FromUri] Guid id) { IPermissionService permissionService = IoC.Container.Resolve <IPermissionService>(); GetPermissionResponse per = permissionService.GetPermission(id); return(per); }
private PermissionView GetPermissionView(string id) { GetRequest request = new GetRequest(); request.ID = Guid.Parse(id); GetPermissionResponse response = this._permissionService.GetPermission(request); return(response.PermissionView); }
public async Task <GetPermissionResponse> GetPermission(GetPermissionRequest request) { var response = new GetPermissionResponse(); var permissions = await _cache.Permissions(); var permission = permissions.FirstOrDefault(c => c.Id == request.Id); response.Permission = permission; return(response); }
public override async Task <GetPermissionResponse> GetPermission(GetPermissionRequest request, ServerCallContext context) { var permission = await _authorizationApp.GetPermissionAsync(request.Id); var result = new GetPermissionResponse { Id = permission.Id, Code = permission.Code, Name = permission.Name, Description = permission.Description, IsEnabled = permission.IsEnabled, }; return(result); }
public JsonResult GetDetail(System.Int32 id) { PermissionDetailView vm = new PermissionDetailView(); GetPermissionRequest request = new GetPermissionRequest(); request.PermissionId = id; GetPermissionResponse response = _permissionService.GetPermission(request); if (response.PermissionFound) { vm = response.Permission.ConvertToPermissionDetailView(); } return(Json(vm, JsonRequestBehavior.AllowGet)); }
public IResponseData <GetPermissionResponse> GetPermission([FromUri] Guid id) { IResponseData <GetPermissionResponse> response = new ResponseData <GetPermissionResponse>(); try { IPermissionService permissionService = IoC.Container.Resolve <IPermissionService>(); GetPermissionResponse per = permissionService.GetPermission(id); response.SetData(per); } catch (ValidationException ex) { response.SetErrors(ex.Errors); response.SetStatus(System.Net.HttpStatusCode.PreconditionFailed); } return(response); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { GetPermissionResponse response = new GetPermissionResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("permission", targetDepth)) { var unmarshaller = ResourceSharePermissionDetailUnmarshaller.Instance; response.Permission = unmarshaller.Unmarshall(context); continue; } } return(response); }
public GetPermissionResponse GetPermission(GetPermissionRequest request) { GetPermissionResponse response = new GetPermissionResponse(); Permission permission = _permissionRepository .FindBy(request.PermissionId); if (permission != null) { response.PermissionFound = true; response.Permission = permission.ConvertToPermissionView(); } else { response.PermissionFound = false; } return(response); }
public GetPermissionResponse GetPermission(GetRequest request) { GetPermissionResponse response = new GetPermissionResponse(); try { Permission permission = new Permission(); PermissionView permissionView = permission.ConvertToPermissionView(); permission = _permissionRepository.FindBy(request.ID); if (permission != null) { permissionView = permission.ConvertToPermissionView(); } response.PermissionView = permissionView; } catch (Exception ex) { } return(response); }