public async Task <CaseFormDto> CreateCaseForm(CaseFormForCreationDto caseFormForCreation) { var newCaseForm = _mapper.Map <CaseForm>(caseFormForCreation); // ! TEMP ! // TODO: Make sure SubmittedBy gets set to currently logged in/authenticated user. newCaseForm.SubmittedBy = await _userManager.FindByNameAsync("*****@*****.**"); // ! currently just for testing purposes // ! TEMP ! newCaseForm = await _caseFormRepo.AddAsync(newCaseForm); _logger.LogInformation(LoggingEvents.InsertItem, "Case form {Id} created", newCaseForm.Id); // TODO: Call EmailService to send submission receipt email to user // TODO: Call EmailService to send submission receipt email to admin? var caseFormDto = _mapper.Map <CaseFormDto>(newCaseForm); return(caseFormDto); }
public async Task <ActionResult <CaseFormDto> > Post(CaseFormForCreationDto caseForm) { var newCaseFormDto = await _caseFormService.CreateCaseForm(caseForm); return(CreatedAtAction("Get", new { id = newCaseFormDto.Id }, newCaseFormDto)); }