public async Task <IActionResult> GrantAccess([FromBody] UserAccessDTO userAccessDto) { try { var command = new GrantAccessCommand(userAccessDto.UserId, userAccessDto.GateId); await mediator.Send(command); return(Ok(new { message = "Access granted to user" })); } catch (MissingInformationProvidedException) { return(BadRequest(new { message = "Please provide user and gate information properly" })); } catch (GateDoesNotExistException) { return(NotFound(new { message = "no such gate" })); } catch (UserDoesNotExistException) { return(NotFound(new { message = "no such user" })); } }
public IActionResult PostLogin([FromBody] LoginModel data) { var command = new GrantAccessCommand(data); return(ProcessCommand(command)); }