public async Task <ActionResult <Student> > GetStudent(int id)
        {
            var query  = new GetStudentByIdQuery(id);
            var result = await _mediator.Send(query);

            return(result != null ? (ActionResult)Ok(result) : NotFound());
        }
        public async Task <IActionResult> GetById([FromRoute] string studentId)
        {
            var query = new GetStudentByIdQuery {
                Id = studentId
            };

            return(Ok(await Mediator.Send(query)));
        }
Ejemplo n.º 3
0
        public IActionResult GetStudent(Guid id_student)
        {
            EnsureArg.IsNotEmpty(id_student);
            var query = new GetStudentByIdQuery(id_student);

            var queryResult = QueryDispatcher.Execute <GetStudentByIdQuery, GetStudentByIdQueryResult>(query);

            return(Ok(queryResult.Student));
        }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> GetById(int id)
        {
            var query = new GetStudentByIdQuery {
                Id = id
            };
            var student = await _queryMediator.ExecuteAsync(query);

            return(Ok(student));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> GetStudentByIdAsync(int studentId)
        {
            var query  = new GetStudentByIdQuery(studentId);
            var result = await mediator.Send(query);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(result));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> GetById([FromRoute] GetStudentByIdQuery query)
        {
            var result = await _mediator.Send(query);

            return(Ok(result));
        }
        public async Task <StudentViewModel> GetStudentAsync(Guid id)
        {
            GetStudentByIdQuery request = new GetStudentByIdQuery(id);

            return(await _mediator.Send(request));
        }
        public async Task <StudentViewModel> GetStudentAsync()
        {
            GetStudentByIdQuery request = new GetStudentByIdQuery(Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)));

            return(await _mediator.Send(request));
        }