コード例 #1
0
        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" }));
        }