public CaptainController(IAccountService accountService, Func <string, IImageService> serviceAccessor, ICaptainService captainService, IHostingEnvironment environment) { _accountService = accountService; _captainService = captainService; _imageService = serviceAccessor("account"); _environment = environment; }
public MainWindow() { InitializeComponent(); TcpClientChannel chan = new TcpClientChannel(); ChannelServices.RegisterChannel(chan, false); // ChannelServices.RegisterChannel(new TcpClientChannel(),false); remoteService = (ICaptainService)Activator.GetObject(typeof(ICaptainService), "tcp://10.12.51.184:8888/serverMethod", null); }
public CaptainQueries(ICaptainService captainService) { FieldAsync <ListCaptainsQueryModelType>( SEARCH_REQUEST_ENDPOINT, "Returns a paginated list of Captains", new QueryArguments( new QueryArgument <NonNullGraphType <PagedRequestType> > { Name = PAGINATION_ARGUMENT_NAME, Description = PagedRequestType.Description }, new QueryArgument <NonNullGraphType <OrderedRequestType> > { Name = ORDERING_ARGUMENT_NAME, Description = OrderedRequestType.Description }, new QueryArgument <NonNullGraphType <FilteredRequestType <Captain> > > { Name = FILTERING_ARGUMENT_NAME, Description = FilteredRequestType <Captain> .Description } ), async context => { var pagination = context.GetArgument <Pagination>(PAGINATION_ARGUMENT_NAME); var ordering = context.GetArgument <Ordering>(ORDERING_ARGUMENT_NAME); var filtering = context.GetArgument <CaptainFilter>(FILTERING_ARGUMENT_NAME); var(totalCount, items) = await captainService.SearchCaptainAsync(pagination, ordering, filtering); try { return(new ListResponse <Captain> { TotalCount = totalCount, Items = items }); } catch (Exception) { context.Errors.Add(new ExecutionError("Server Error")); return(null); } } ); }
public CaptainMutations(ICaptainService service) { FieldAsync <ActionResponseType>( CREATE_REQUEST_ENDPOINT, "Creates a new Captain", new QueryArguments( new QueryArgument <NonNullGraphType <CaptainCreateViewModel> > { Name = UPDATE_CREATE_ARGUMENT_NAME, Description = "Captain Entity to be Created" }), async context => { var captain = context.GetArgument <Captain>(UPDATE_CREATE_ARGUMENT_NAME); try { await service.CreateCaptainAsync(captain); } catch (ValidationException e) { context.Errors.Add(new ExecutionError(e.Message)); return(new ActionResponse(false)); } catch (Exception) { context.Errors.Add(new ExecutionError("Server Error")); return(new ActionResponse(false)); } return(new ActionResponse(true, captain.Id)); }); FieldAsync <ActionResponseType>( UPDATE_REQUEST_ENDPOINT, "Updates an existing Captain", new QueryArguments( new QueryArgument <NonNullGraphType <CaptainUpdateViewModel> > { Name = UPDATE_CREATE_ARGUMENT_NAME, Description = "Captain to be Updated" }), async context => { var captain = context.GetArgument <Captain>(UPDATE_CREATE_ARGUMENT_NAME); try { await service.UpdateCaptainAsync(captain); } catch (ValidationException e) { context.Errors.Add(new ExecutionError(e.Message)); return(new ActionResponse(false)); } catch (Exception) { context.Errors.Add(new ExecutionError("Server Error")); return(new ActionResponse(false)); } return(new ActionResponse(true, captain.Id)); }); FieldAsync <ActionResponseType>( DELETE_REQUEST_ENDPOINT, "Removes an existing Captain", new QueryArguments( new QueryArgument <GuidGraphType> { Name = DELETE_ARGUMENT_NAME, Description = "Captain Id used to identify which Captain will be deleted" }), async context => { var id = context.GetArgument <Guid>(DELETE_ARGUMENT_NAME); try { await service.DeleteCaptainAsync(id); } catch (ValidationException e) { context.Errors.Add(new ExecutionError(e.Message)); return(new ActionResponse(false)); } catch (Exception) { context.Errors.Add(new ExecutionError("Server Error")); return(new ActionResponse(false)); } return(new ActionResponse(true)); }); }
public ReservationController(IReservationService reservationService, ICaptainService captainService, IPitchService pitchService) { _reservationService = reservationService; _captainService = captainService; _pitchService = pitchService; }
public AccountController(IUserService userService, IAccountService accountService, ICaptainService captainService) { _userService = userService; _accountService = accountService; _captainService = captainService; }