Example #1
0
        public async Task <IActionResult> RegisterByCode(string code)
        {
            code = code?.Trim();

            if (string.IsNullOrEmpty(code) || !_droneService.IsCodeValid(code))
            {
                return(BadRequest("invalid_data"));
            }

            var identityUser = await _userManager.GetUserAsync(User);

            var person = await _personService.GetByIdAsync(identityUser.PersonId);

            _droneService.AttachDroneToPerson(person.Id, code);

            return(Ok());
        }