Beispiel #1
0
        public async Task <ActionResult <IEnumerable <BookingGuestViewModel> > > GetAllByGuestId()
        {
            var id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor);

            return(Ok(await Mediator.Send(new GetAllBookingsByGuestQuery {
                Id = id
            })));
        }
Beispiel #2
0
        public async Task <ActionResult <string> > UploadImage(IFormFile file)
        {
            var id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor);

            return(Ok(await Mediator.Send(new UploadUserImageCommand()
            {
                Id = id, ImageFile = file
            })));
        }
Beispiel #3
0
        public async Task <ActionResult <UserViewModel> > Get()
        {
            var accesToken = Request.Headers["Authorization"].ToString().Replace("Bearer ", string.Empty);
            var id         = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor);

            var user = await Mediator.Send(new GetUserQuery { Id = id });

            if (user is null)
            {
                user = await Mediator.Send(new CreateUserCommand { Token = accesToken });
            }

            return(Ok(user));
        }
Beispiel #4
0
        public async Task <ActionResult <UserViewModel> > Update([FromBody] UpdateUserCommand command)
        {
            command.Id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor);

            return(Ok(await Mediator.Send(command)));
        }
Beispiel #5
0
        public async Task <ActionResult <int> > Create([FromBody] CreateBookingCommand command)
        {
            command.Id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor);

            return(Ok(await Mediator.Send(command)));
        }