public async Task <ActionResult <IEnumerable <BookingGuestViewModel> > > GetAllByGuestId() { var id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor); return(Ok(await Mediator.Send(new GetAllBookingsByGuestQuery { Id = id }))); }
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 }))); }
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)); }
public async Task <ActionResult <UserViewModel> > Update([FromBody] UpdateUserCommand command) { command.Id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor); return(Ok(await Mediator.Send(command))); }
public async Task <ActionResult <int> > Create([FromBody] CreateBookingCommand command) { command.Id = IdFromClaimsResolver.Resolve(httpContextAccessor as HttpContextAccessor); return(Ok(await Mediator.Send(command))); }