public async Task <StudyResultsAndLearningsDto> UpdateResultsAndLearningsAsync(int studyId, StudyResultsAndLearningsDto resultsAndLearnings) { var studyFromDb = await GetStudyForUpdateAsync(studyId, UserOperation.Study_Update_ResultsAndLearnings); if (resultsAndLearnings.ResultsAndLearnings != studyFromDb.ResultsAndLearnings) { studyFromDb.ResultsAndLearnings = resultsAndLearnings.ResultsAndLearnings; } var currentUser = await _userService.GetCurrentUserAsync(); studyFromDb.Updated = DateTime.UtcNow; studyFromDb.UpdatedBy = currentUser.UserName; await _db.SaveChangesAsync(); return(new StudyResultsAndLearningsDto() { ResultsAndLearnings = studyFromDb.ResultsAndLearnings }); }
public async Task <IActionResult> UpdateResultsAndLearningsAsync(int studyId, StudyResultsAndLearningsDto resultsAndLearnings) { var resultsAndLearningsFromDb = await _studyUpdateService.UpdateResultsAndLearningsAsync(studyId, resultsAndLearnings); return(new JsonResult(resultsAndLearningsFromDb)); }