public IActionResult Get(int id) { var entity = houseRepository.Get(id); var result = mapper.Map <HouseDto>(entity); return(Ok(entity)); }
public async Task <ActionResult <CreatePersonView> > CreatePersonRequest( CancellationToken cancellationToken, [FromRoute] Guid houseId, [FromBody] CreatePersonBinding binding) { try { var house = await _houseRepository.Get(houseId, cancellationToken); if (house == null) { return(NotFound($"House not found: {houseId}")); } var person = new CreatePersonRequest(Guid.NewGuid(), binding.Name, binding.Surname, binding.Login, binding.Password, house); await _createPersonRepository.Create(person, cancellationToken); return(Ok(new CreatePersonView { Id = person.Id, Name = person.Name, Surname = person.Surname, Login = person.Login })); } catch (InvalidOperationException exception) { return(Conflict(exception.Message)); } }
public House Get(int id) { return(_houseRepository.Get(id)); }
public HouseDto Get(Guid id) { return(_mapper.Map <HouseDto>(_houseRepository.Get(id))); }