public async Task <EmprestimoResponse> EmprestarAsync(EmprestimoRequest emprestimoRequest) { var emprestimo = _mapper.Map <Emprestimo>(emprestimoRequest); emprestimo.DataEmprestimo = DateTime.Now; emprestimo.DataPrevistaDeVolucao = CalcularDataPrevistaDevolucao(emprestimo); foreach (var item in emprestimo.ItensEmprestados) { item.Emprestimo = emprestimo; } return(await Task.FromResult(_mapper.Map <EmprestimoResponse>(_emprestimoRepositorio.Inserir(emprestimo)))); }