public async Task <IActionResult> Get([FromQuery] Guid?Id, [FromQuery] string?Name)
        {
            if (Id != null)
            {
                var vehicle = await _vehiclesRepository.GetById((Guid)Id);

                return(Ok(new { status = "success", data = vehicle }));
            }
            if (Name != null)
            {
                var vehicle = await _vehiclesRepository.GetByName((string)Name);

                return(Ok(new { status = "success", data = vehicle }));
            }

            return(Ok(new { status = "error", data = "Not found" }));
        }
Esempio n. 2
0
        public VehicleViewModel Get(string id)
        {
            var vehicle = repository.GetById(id);

            return(mapper.Map <VehicleViewModel>(vehicle));
        }