public async Task <IActionResult> Edit(int id, IntercityLink edge) { if (id != edge.Id) { return(NotFound()); } if (ModelState.IsValid) { ///TODO: Update the EdgeString as well!!! (GraphString not updating after Update Edge) db.Update(edge); await db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(edge)); }
public void VerifyIntercityLinkModelRequiredAnnotations() { var edgeToValidate = new IntercityLink { NodesPair = new VerticesPair { FirstNodeId = 1, RelatedNodeId = 2 } }; var errorCount = CheckPropertyValidation.Validate(edge).Count; if (errorCount == 0 && (edgeToValidate.Length == defaultValueOfDouble || edgeToValidate.Price == defaultValueOfDouble || edgeToValidate.ServiceClass == defaultValueOfByte)) { errorCount++; } Assert.AreEqual(ClassValidationError, errorCount); }
public void GraphInit() { graph = new GraphMap { Id = 1003, Name = "TestMap", Graph = new Graph(), IsDefault = false, GraphString = string.Empty, NodeHistory = new System.Collections.Generic.List <string> { string.Empty }, EdgeHistory = new System.Collections.Generic.List <string> { string.Empty }, NodeHistoryString = string.Empty, EdgeHistoryString = string.Empty, CurrentEdgeIdToAdd = 1005 }; vertex = new TransportVertex { Name = "TestVertex", Description = "TestDescr" }; edge = new IntercityLink { Length = 2843.874, Price = 48.17, ServiceClass = 4, NodesPair = new VerticesPair { FirstNodeId = 1, RelatedNodeId = 2 } }; }