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));
 }
Beispiel #2
0
        public int AddOwner(Owner owner)
        {
            context.Owners.Add(owner);
            Save();

            // Return the VehicleID of the recently added vehicle
            return context.Owners.Max(o => o.OwnerID);
        }
        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");
        }
Beispiel #4
0
 public void DeleteOwner(Owner owner)
 {
     context.Owners.Remove(owner);
     Save();
 }