public void VerifyTransportVertexModelRequiredAnnotations() { var vertexForValidation = new TransportVertex { Description = "TestDescr" }; var errorCount = CheckPropertyValidation.Validate(vertexForValidation).Count; Assert.AreEqual(ClassValidationError, errorCount); }
public async Task <IActionResult> Create(TransportVertex node) { if (ModelState.IsValid) { db.Add(node); await db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(node)); }
public async Task <IActionResult> Edit(int id, TransportVertex node) { if (id != node.Id) { return(NotFound()); } if (ModelState.IsValid) { db.Update(node); await db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(node)); }
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 } }; }