Пример #1
0
		// 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);

		}
Пример #2
0
		public ActionResult Register(FormCollection collection)
		{
			try
			{
				var model = new BicycleModel();

				UpdateModel(model);

				var repository = new StudentParkingPermitRepository();

				//Update database with create
				repository.AddParkingRegistration(model);

				//if no errors, show registration complete

				return View("RegistrationComplete");
			}
			catch (Exception ex)
			{
				// ReSharper disable once UnusedVariable
				var msg = ex.Message;
				return View();
			}
		}