예제 #1
0
        public async Task <IActionResult> Get()
        {
            var request  = new GetSchoolRequest();
            var response = await _mediator.Send(request);

            return(Ok(response));
        }
예제 #2
0
        //

        //
        public Task <GetSchoolResponse> GetSchoolAsync(GetSchoolRequest request)
        {
            //
            var client = new JsonServiceClient(Config.http);
            var task   = client.GetAsync(request);

            return(task);
            //
        }
예제 #3
0
        public async Task <SchoolResponse> ReadOnlyGetSchoolAsync(GetSchoolRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException($"Request is null");
            }

            var result = await _schoolRepository.ReadOnlyGetByIdAsync(request.Id);

            return(_schoolMapper.Map(result));
        }
예제 #4
0
        public GetSchoolResponse GetSchool(GetSchoolRequest request)
        {
            var response = new GetSchoolResponse();

            var query = new GetOrganizationByIdQuery(request.SchoolID);
            var result = this._repository.ExecuteQuery(query);

            if (result.Status == Status.Success)
                response.Value = (School)result.Value;

            return response;
        }
        public async Task getSchool_should_get_data(int id)
        {
            var schoolRequest = new GetSchoolRequest {
                Id = id
            };

            var result =
                await _sut.ReadOnlyGetSchoolAsync(schoolRequest);

            result.ShouldNotBeNull();
            result.Id.ShouldBe(id);
            result.Name.ShouldBe("WU");
            result.Country.ShouldBe("Austria");
        }
예제 #6
0
        public object Get(GetSchoolRequest request)
        {
            OrmLiteConfig.DialectProvider = MySqlDialectProvider.Instance;

            IDbConnection db =
                _connectstring.OpenDbConnection();

            List <School> schools = db.Select <School>(
                );

            db.Close();
            GetSchoolResponse res = new  GetSchoolResponse()
            {
                Schools = schools
            };

            return(res);
        }