Esempio n. 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
            })));
        }
Esempio n. 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
            })));
        }
Esempio n. 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));
        }
Esempio n. 4
0
        public async Task <ActionResult <UserViewModel> > Update([FromBody] UpdateUserCommand command)
        {
            command.Id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor);

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

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