public async Task <IActionResult> CreatePerson(PersonToAddDto personToAdd) { try { var guid = await _repo.CreatePerson(personToAdd); return(guid == Guid.Empty ? (IActionResult)StatusCode(500) : Ok(guid)); } catch (Exception) { return(StatusCode(500)); } }
public async Task <Guid> CreatePerson(PersonToAddDto personToAdd) { var person = new Person() { PersonId = Guid.NewGuid(), Occupation = personToAdd.Occupation, AvatarUrl = personToAdd.AvatarUrl, FirstName = personToAdd.FirstName, LastName = personToAdd.LastName }; await _context.People.AddAsync(person); await SaveAll(); return(person.PersonId); }