public ActionPlan Update(UpdateActionPlanCommand command) { var ActionPlan = _repository.GetOne(command.Id); if (!string.IsNullOrEmpty(command.Description)) { ActionPlan.ChangeDescription(command.Description); } if (command.Objective != null) { foreach (var objective in command.Objective) { ActionPlan.AddObjective(objective); } } _repository.Update(ActionPlan); if (Commit()) { return(ActionPlan); } return(null); }
public Task <HttpResponseMessage> Put([FromBody] dynamic body) { var listObjective = _serviceObjective.AddToActionPlan(body.objective); var coachingProcess = _serviceCoachingProcess.GetOne(Guid.Parse((string)body.idCoachingprocess)); var commandActionPlan = new UpdateActionPlanCommand( Guid.Parse((string)body.id), listObjective, coachingProcess, (string)body.description ); _serviceObjective.CheckObjectiveRemoved(listObjective, Guid.Parse((string)body.id)); var actionPlan = _serviceActionPlan.Update(commandActionPlan); return(CreateResponse(HttpStatusCode.Created, actionPlan)); }