public ActionResult AssignTag(FormCollection collection) { try { var model = new StudentRegistrationModel(); UpdateModel(model); //TODO investigate why Id is getting populated, and RowId is being lost // Need to create a viewModel? Or hide the RowId field in the view? model.RowId = model.Id; var repo = new StudentParkingPermitRepository(); var entity = repo.UpdateParkingTag(model); //var models = GetRegistrations(new List<Admin_Security_ParkingRegistration> { entity }); //TempData["Registrations"] = models; return RedirectToAction("Details", new {id = entity.RowID}); } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; return View(); } }
public ActionResult AssignTag(string id) { var repo = new StudentParkingPermitRepository(); var entity = repo.GetByRowId(id); var model = GetRegistration(entity); return View(model); }
public ActionResult ManageStudentRegistration(FormCollection collection) { try { var model = new RegistrationLookupModel(); UpdateModel(model); var repo = new StudentParkingPermitRepository(); List<Admin_Security_ParkingRegistration> entities; //lookup using selected criteria switch (model.SearchBy) { case SearchByEnum.FacStaffId: var entity = repo.GetByStudentId(model.KeywordSearch); entities = new List<Admin_Security_ParkingRegistration> {entity}; break; case SearchByEnum.LastName: entities = repo.GetByLastName(model.KeywordSearch); break; case SearchByEnum.FirstName: entities = repo.GetByFirstName(model.KeywordSearch); break; case SearchByEnum.LicenseNumber: entities = repo.GetbyLicenseNumber(model.KeywordSearch); break; case SearchByEnum.TagNumber: entities = repo.GetByTagNumber(model.KeywordSearch); break; default: throw new ArgumentOutOfRangeException(); } //populate model var registrations = GetRegistrations(entities); //redirect to display results TempData["Registrations"] = registrations; return RedirectToAction("ShowRegistrations"); } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; return View(); } }
// 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); }
public ActionResult Register(FormCollection collection) { try { var model = new MotorcycleModel(); UpdateModel(model); var repository = new StudentParkingPermitRepository(); //Update database with create repository.AddParkingRegistration(model); //if no errors, show registration complete return View("RegisterationComplete"); } catch (Exception ex) { var msg = ex.Message; return View(); } }
public ActionResult EditStudentRegistration(string id, FormCollection collection) { try { var model = new StudentRegistrationModel(); UpdateModel(model); var repo = new StudentParkingPermitRepository(); var entity = repo.Update(model); //var models = GetRegistrations(new List<Admin_Security_ParkingRegistration> {entity}); //TempData["Registrations"] = models; //return RedirectToAction("ShowRegistrations"); return RedirectToAction("Details", new {id = entity.RowID}); } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; return View(); } }
public ActionResult DeleteStudentRegistration(string id, FormCollection collection) { try { var repo = new StudentParkingPermitRepository(); repo.Remove(id); return RedirectToAction("Index"); } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; return View(); } }