public long Create(Type resourceType, Action <Resource> initializer) { ValidateHealthState(); var resource = TypeController.Create(resourceType.ResourceType()); initializer(resource); ResourceGraph.Save(resource); return(resource.Id); }
public void Create_Valid() { //Arrange Type model = new Type() { Description = "test", Status = "test" }; //Act var result = (RedirectToRouteResult)controllerWEB.Create(new TypeViewModel { Description = model.Description, Status = model.Status }); //Assert Assert.AreEqual("Index", result.RouteValues["action"]); }
static void Main(string[] args) { string connectionString = "Host=localhost;Username=postgres;Password=p;Database=CityTransport"; int table = 0; int action = 0; do { table = FirstMenu(); if (table == 0) { return; } BaseController controller = null; switch (table) { case 1: action = SecondMenu("Garage"); controller = new GarageController(connectionString); break; case 2: action = SecondMenu("Route"); controller = new RouteController(connectionString); break; case 3: action = SecondMenu("Stop"); controller = new StopController(connectionString); break; case 4: action = SecondMenu("Transport"); controller = new TransportController(connectionString); break; case 5: action = SecondMenu("Type"); controller = new TypeController(connectionString); break; } switch (action) { case 1: controller.Create(); break; case 2: controller.Read(); break; case 3: controller.Update(); break; case 4: controller.Delete(); break; case 5: controller.Find(); break; case 6: controller.Generate(); break; } } while (true); }