Пример #1
0
        public async Task <IActionResult> PUTAtualiza(locadora.models.Veiculo veiculonovo)
        {
            using (var db = new AppDb(null))
            {
                await db.Connection.OpenAsync();

                var query  = new VeiculoQuery(db);
                var result = await query.AlteraVeiculoAsync(veiculonovo);

                return(new OkObjectResult(result));
            }
        }
Пример #2
0
        public async Task <IActionResult> DeleteID(string placa)
        {
            using (var db = new AppDb(null))
            {
                await db.Connection.OpenAsync();

                var query  = new VeiculoQuery(db);
                var result = await query.DeletaVeiculoAsync(placa);

                return(new OkObjectResult(result));
            }
        }
Пример #3
0
        public async Task <IActionResult> Get()
        {
            using (var db = new AppDb(null))
            {
                await db.Connection.OpenAsync();

                var query  = new VeiculoQuery(db);
                var result = await query.ListaVeiculoAsync();

                return(new OkObjectResult(result));
            }
        }
        public async Task <IActionResult> GetVeiculoAsync([FromRoute][Required] Guid id)
        {
            var query = new VeiculoQuery()
            {
                Id = id
            };
            var result = await _commandQueryVeiculo.Handle(query).ConfigureAwait(true) as QueryResult;

            if (result.Success)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound(result.Messages));
            }
        }