Пример #1
0
        public async Task <IHttpActionResult> Delete(DtoVehiculo item)
        {
            try
            {
                if (item != null)
                {
                    await Task.Run(() =>
                    {
                        item.Estado = EnumEstados.Eliminado;
                        LogicaVehiculos.ActualizarVehiculo(item);
                    });

                    return(Ok("Vehiculo eliminado."));
                }
                else
                {
                    return(BadRequest("Incorrect call"));
                }
            }
            catch (Exception ex)
            {
                ClsVisorEventos.LogEvent(ex);
                return(BadRequest($"Incorrect call:{ex.Message}"));
            }
        }
Пример #2
0
        public async Task <IHttpActionResult> Get(DtoVehiculo item)
        {
            try
            {
                List <DtoVehiculo> lista = new List <DtoVehiculo>();


                await Task.Run(() =>
                {
                    lista = LogicaVehiculos.ConsultarVehiculo(item);
                });

                if (lista != null)
                {
                    return(Ok(lista));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                ClsVisorEventos.LogEvent(ex);
                return(BadRequest($"Incorrect call:{ex.Message}"));
            }
        }
Пример #3
0
        public async Task <IHttpActionResult> Edit(DtoVehiculo item)
        {
            try
            {
                if (item != null)
                {
                    await Task.Run(() =>
                    {
                        LogicaVehiculos.ActualizarVehiculo(item);
                    });

                    return(Ok("Vehiculo actualizado"));
                }
                else
                {
                    return(BadRequest("Incorrect call"));
                }
            }
            catch (Exception ex)
            {
                ClsVisorEventos.LogEvent(ex);
                return(BadRequest($"Incorrect call:{ex.Message}"));
            }
        }