public async Task <IActionResult> GetPerson(int id) { var person = await _repository.GetPerson(id); var personToReturn = _mapper.Map <PersonForDetailDto>(person); var customerId = _repository.GetCustomerIdByPersonId(id); var customerNotes = await _repository.GetCustomerNotes(customerId); personToReturn.CustomerNotes = _mapper.Map <ICollection <NoteForDetailDto> >(customerNotes); return(Ok(personToReturn)); }
public async Task <IActionResult> GetTicket(int id) { var ticket = await _repository.GetTicket(id); var ticketToReturn = _mapper.Map <TicketForDetailDto>(ticket); var ticketNotes = await _repository.GetTicketNotes(id); ticketToReturn.TicketNotes = _mapper.Map <ICollection <NoteForDetailDto> >(ticketNotes); var customerNotes = await _repository.GetCustomerNotes(ticket.Item.CustomerId); ticketToReturn.CustomerNotes = _mapper.Map <ICollection <NoteForDetailDto> >(customerNotes); var itemNotes = await _repository.GetItemNotes(ticket.ItemId); ticketToReturn.ItemNotes = _mapper.Map <ICollection <NoteForDetailDto> >(itemNotes); var productSpecificationNotes = await _repository.GetProductSpecificationNotes(ticket.Item.ProductSpecificationId); ticketToReturn.ProductSpecificationNotes = _mapper.Map <ICollection <NoteForDetailDto> >(productSpecificationNotes); return(Ok(ticketToReturn)); }