public bool UpdateOtd(Guid stageId, int noteId, bool isChecked, Guid id) { var repository = new ReadOnlyDictionaryRepository().GetExpDicPrimaryOTDs(); var model = GetExpertiseStageById(stageId); if (model == null) { return(false); } var dic = repository.FirstOrDefault(e => e.Id == noteId); if (model.OtdIds == null) { model.OtdIds = ""; } var otdIds = model.OtdIds.Split(',').ToList(); var prevOtdIds = new List <string>(otdIds); GetOtdChildren(otdIds, dic, isChecked); GetOtdParent(otdIds, dic, isChecked); var uncheckedOtIds = prevOtdIds.Except(otdIds).ToList(); var checkedOtIds = otdIds.Except(prevOtdIds).ToList(); var addLogInfo = ""; if (uncheckedOtIds.Count > 0) { var uncheckedOtIdsStr = String.Join(",", uncheckedOtIds); addLogInfo += "снята галочка с пунктов: " + uncheckedOtIdsStr; } if (checkedOtIds.Count > 0) { var checkedOtIdsStr = String.Join(",", checkedOtIds); addLogInfo += "поставлена галочка в пунктах: " + checkedOtIdsStr; } var stageName = ExpStageNameHelper.GetName(model.StageId); ActionLogger.WriteInt(AppContext, stageName + ": Заявление №" + model.EXP_DrugDeclaration.Number + ": изменения значений экспертизы(галочки)", addLogInfo); model.OtdIds = string.Join(",", otdIds); AppContext.SaveChanges(); return(true); }