/// <summary> /// подробно о значении /// </summary> /// <param name="id">ид значения</param> /// <returns></returns> public async Task <ActionResult> Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var value = await service.GetValueById((long)id); if (value == null) { return(HttpNotFound()); } return(View(value)); }
private static void BuildDocumentMapValues(FileData file) { var stopwatch = new Stopwatch($"Build DocumentMap Values for \"{file.Path}\""); try { if (file == null) { return; } var text = string.Empty; var lines = file.RawTextString.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList(); Parallel.ForEach(file.FileValues.Where(item => item.DocumentMap), (item) => { if (lines.Count >= item.iLine - 1) { text = lines[item.iLine]; } var value = ValueService.GetValueById(item.ValueId); // Why would value be null, do we have another list that has an old reference that is no longer valid. // I deleted a value and then GetValueByid returned a null value, thus I added this code // TODO: I need to research why - Sara if (value == null) { return; } var filtered = value.DocumentMapFiltered; var de = new DocumentEntry { Name = item.Name, iLine = item.iLine, Value = item.Value, Type = DocumentMapType.Value, Id = item.ValueId, Level = item.Level, Text = text, Filtered = filtered, Sort = item.Sort }; lock (file.DocumentMap) file.DocumentMap.Add(de); }); } catch (Exception ex) { // We are updating the data in the background // Once the update is complete the system will trigger for this view to Render - Sara if (ex is InvalidOperationException && ex.Message == "Collection was modified; enumeration operation may not execute.") { // Do Nothing } else { throw; } } stopwatch.Stop(0); }