public async Task <IActionResult> GetAsync(int id) { // Act. InquirySample inquirySample = await _inquirySampleRepository.GetByIdAsync(id); // Map. var output = _mapper.Map <InquirySampleDto>(inquirySample); // Return. return(Ok(output)); }
public async Task <IActionResult> DeleteAsync(int id) { // Act. InquirySample inquirySample = await _inquirySampleRepository.GetByIdAsync(id); InquiryFull inquiry = await _inquiryRepository.GetByIdAsync(inquirySample.Inquiry); if (!inquiry.State.AllowWrite) { throw new EntityReadOnlyException(); } await _inquirySampleRepository.DeleteAsync(id); // FUTURE: Should only select inquiry if (await _inquirySampleRepository.CountAsync() == 0) { inquiry.State.TransitionToTodo(); await _inquiryRepository.SetAuditStatusAsync(inquiry.Id, inquiry); } // Return. return(NoContent()); }