// GET: Bicycle/Register public ActionResult Register(string id, string firstName, string lastName) { var repository = new StudentParkingPermitRepository(); var entity = repository.GetByStudentIdAndVehicleType(id, VehicleEnum.Bicycle.ToString().ToLower()); if (entity != null) { return RedirectToAction("ExistingVehicleType"); } //Show the view and populate Get Vehicle Model var model = new BicycleModel { FirstName = firstName, LastName = lastName, StudentId = id }; return View("Register", model); }
// GET: Auto/Register public ActionResult Register(string id, string firstName, string lastName) { // Check for record based on studentID and vehicletype in parkingadmin table. // if record exist, populate model, and display appropriate form. // if record does not exist, populate model with just student name and display vehicle form. var repository = new StudentParkingPermitRepository(); var entity = repository.GetByStudentIdAndVehicleType(id, VehicleEnum.Auto.ToString().ToLower()); if (entity != null) { return RedirectToAction("ExistingVehicle"); } //Show the view and populate Get Vehicle Model var model = new VehicleModel { FirstName = firstName, LastName = lastName, StudentId = id }; return View("Register", model); }