public ActionResult Save() { ParkedVehicle parkedVehicle = new ParkedVehicle(); Owner owner = new Owner(); Vehicle vehicle = new Vehicle(); return View(new Tuple<ParkedVehicle, Owner, Vehicle>(parkedVehicle, owner, vehicle)); }
public int AddVehicle(Vehicle vehicle) { context.Vehicles.Add(vehicle); Save(); // Return the VehicleID of the recently added vehicle return context.Vehicles.Max(o => o.VehicleID); }
public ActionResult Save(ParkedVehicle Item1, Owner Item2, Vehicle Item3) { if (Item1.VehicleID == -1) { var a = new VehicleRepository().AddVehicle(Item3); Item1.VehicleID = a; } if (Item1.OwnerID == -1) { var id = new OwnerRepository().AddOwner(Item2); Item1.OwnerID = id; } new ParkedVehicleRepository().AddParkVehicle(Item1); ViewBag.SaveReultMessage = "You have perked your vehicle ! on " + ((Enumerators.ParkingSpot)Item1.ParkingSpotID).ToString(); return RedirectToAction("Index", "VehicleList"); }
public void DeleteVehicle(Vehicle vehicle) { context.Vehicles.Remove(vehicle); Save(); }