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(); } }
private static FacStaffRegistrationModel GetRegistration(Admin_Security_ParkingRegistration_FacStaff entity) { var date = entity.DateTagIssued?.ToString("d") ?? DateTime.Now.ToString("d"); var model = new FacStaffRegistrationModel() { RowId = entity.RowID.ToString(), AssignedBy = entity.IssuedBy, FacStaffId = entity.FacStaffID, TagNumber = entity.TagNumber, FirstName = entity.FirstName, LastName = entity.LastName, Phone = entity.Phone, Location = entity.Location, VehicleType = entity.VehicleType, Make = entity.CarMake, Color = entity.Color, Year = entity.CarYear.ToString(), LicensePlate = entity.LicenseNumber, State = entity.State, Model = entity.CarModel, DateTagIssued = date }; return model; }
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(); } }