public async Task <ActionResult> Edit(Guid objectiveId, Guid keyResultId, [FromForm] SaveKeyResultFormModel formModel) { var objective = await _objectivesRepository.GetObjectiveById(objectiveId); var keyResult = objective.KeyResults.Single(x => x.Id == keyResultId); keyResult.Description = formModel.Description; keyResult.Touch(); await _objectivesRepository.SaveObjective(objective); return(RedirectToAction(nameof(Details), new { objectiveId, keyResultId = keyResult.Id })); }
public async Task <ActionResult> Add(Guid objectiveId, [FromForm] SaveKeyResultFormModel formModel) { var objective = await _objectivesRepository.GetObjectiveById(objectiveId); var keyResult = new KeyResult { Description = formModel.Description }; objective.AddKeyResult(keyResult); await _objectivesRepository.SaveObjective(objective); return(RedirectToAction("Details", "Objective", new { id = objectiveId })); }