public ActionResult AssignTag(string id, FormCollection collection) { try { var model = new FacStaffRegistrationModel(); 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 FacStaffParkingPermitRepository(); var entity = repo.UpdateParkingTag(model); //var models = GetRegistrations(new List<Admin_Security_ParkingRegistration_FacStaff> { 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 FacStaffParkingPermitRepository(); var entity = repo.GetByRowId(id); var model = GetRegistration(entity); return View(model); }
public ActionResult ManageFacStaffRegistration(FormCollection collection) { try { var model = new RegistrationLookupModel(); UpdateModel(model); var repo = new FacStaffParkingPermitRepository(); List<Admin_Security_ParkingRegistration_FacStaff> entities; //lookup using selected criteria switch (model.SearchBy) { case SearchByEnum.FacStaffId: var entity = repo.GetByFacStaffId(model.KeywordSearch); entities = new List<Admin_Security_ParkingRegistration_FacStaff> { 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 FacStaffParkingPermitRepository(); 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 BicycleFacStaffModel { FirstName = firstName, LastName = lastName, FacStaffId = id }; return View("Register", model); }
// GET: Motorcycle/Register public ActionResult Register(string id, string firstName, string lastName) { // Check for record based on studentID and vehicle type 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 FacStaffParkingPermitRepository(); var entity = repository.GetByStudentIdAndVehicleType(id, VehicleEnum.Motorcycle.ToString().ToLower()); if (entity != null) { return RedirectToAction("ExistingVehicleType"); } //Populate Get Vehicle Model var model = new MotorcycleFacStaffModel { FirstName = firstName, LastName = lastName, FacStaffId = id }; return View("Register", model); }
public ActionResult Register(FormCollection collection) { try { var model = new MotorcycleFacStaffModel(); UpdateModel(model); var repository = new FacStaffParkingPermitRepository(); //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(); } }
public ActionResult EditFacStaffRegistration(string id, FormCollection collection) { try { var model = new FacStaffRegistrationModel(); UpdateModel(model); var repo = new FacStaffParkingPermitRepository(); var entity = repo.Update(model); return RedirectToAction("Details", new {id = entity.RowID}); } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; return View(); } }