public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Hiker hiker = db.Hikers.Find(id); hiker.AgeGroups = db.AgeGroups.ToList(); if (hiker == null) { return(HttpNotFound()); } return(View(hiker)); }
public ActionResult Create([Bind(Include = "ID,LastName,FirstName,AgeGroupID")] Hiker hiker) { var viewModel = new Hiker { AgeGroups = db.AgeGroups.ToList() }; if (ModelState.IsValid) { db.Hikers.Add(hiker); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(viewModel)); }
// GET: HikerController/Details/5 public IActionResult Details(int?id) { Hiker Hiker = _hikerService.GetHikerRecord(id); try { _wishlistService.CheckEmptyWishlist(); Hiker.Wishlists = _wishlistService.GetWishlist(Hiker.HikerId); RedirectToRoute("Details", new { id }); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(View(Hiker)); }
public void AddTrail_AddsTrailToHiker_TrailList() { Trail testTrail = new Trail("TrailName1", 1, 2.5f, 3, true, true, true, true, true, true); testTrail.Save(); Hiker testHiker = new Hiker("Test Name", "first", "last", 98105, "(803)234-5554", "*****@*****.**", 1, 1); testHiker.Save(); testHiker.AddTrail(testTrail); List <Trail> result = testHiker.GetTrails(); List <Trail> testList = new List <Trail> { testTrail }; CollectionAssert.AreEqual(testList, result); }
private void buttonDesactivarUsuarioRegular_Click(object sender, EventArgs e) { int indexAdminListView = listViewUsuariosRegulares.SelectedIndices[0]; //MessageBox.Show("Index: " + indexAdminListView.ToString()); Hiker user = SesionActual.getInstance().modUsuariosRegulares.listaHikers[indexAdminListView]; //MessageBox.Show("Usuario: " + user.alias); try { SesionActual.getInstance().modUsuariosRegulares.inactivarHiker(user); MessageBox.Show("Usuario Desactivado!"); } catch { } }
public void CheckEmptyWishlist() { Hiker currentHiker = FindCurrentHiker(); List <HikerParkWishlist> currentHikerWishlist = GetWishlist(currentHiker.HikerId); int emptyWishlist = currentHikerWishlist.Count(); if (emptyWishlist > 0) { currentHiker.EmptyWishlist = false; _context.Hikers.Update(currentHiker); _context.SaveChangesAsync(); } else { currentHiker.EmptyWishlist = true; _context.Hikers.Update(currentHiker); _context.SaveChangesAsync(); } }
public async Task <ActionResult> DeleteConfirmed(int id) { try { Hiker hiker = _hikerService.GetHikerRecord(id); IdentityUser user = _hikerService.CurrentUser(hiker); List <HikerParkWishlist> wishlist = _wishlistService.GetWishlist(hiker.HikerId).ToList(); if (wishlist.Count > 0) { _wishlistService.DeleteWishlist(hiker.HikerId); } _hikerService.DeleteHiker(hiker.HikerId); _hikerService.DeleteApplicant(user.Id); await LogOutUser(); return(RedirectToAction("Index", "Park")); } catch { return(View()); } }
public async Task GetHikerLatLong(ApiKeys apiKeys, Hiker hiker) { string HikerKey = apiKeys.GeoKey; string HikerAddress = hiker.StreetAddress; string HikerCity = hiker.City; string HikerState = hiker.State; string url = $"https://maps.googleapis.com/maps/api/geocode/json?address={HikerAddress},+{HikerCity},+{HikerState}&key={HikerKey}"; HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync(url); string jsonresult = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { HikerJsonInfo hikerJsonInfo = JsonConvert.DeserializeObject <HikerJsonInfo>(jsonresult); string HikerLat = hikerJsonInfo.results[0].geometry.location.lat.ToString(); string HikerLng = hikerJsonInfo.results[0].geometry.location.lng.ToString(); hiker.Latitude = HikerLat.ToString(); hiker.Longitude = HikerLng.ToString(); await db.SaveChangesAsync(); } }
// GET: Hikers/Details/5 public ActionResult Details(int?id) { int hikerNum = CheckUserID(); id = hikerNum; // assigns logged in user id -- works // Add items to wishlist var hikerParkWishlist = db.HikerParkWishlists.Where(w => w.HikerId == id).ToList(); // Compares logged in user with id on Wishlist junction table -- works - shows correct amount on wishlist if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Hiker hiker = db.Hikers.Find(id); if (hiker == null) { return(HttpNotFound()); } @RedirectToRoute("Details", new { id = hikerNum }); return(View(hiker)); }
// Find Application User Record - Whole Record public IdentityUser CurrentUser(Hiker hiker) => _context.Users.Where(s => s.Id == hiker.ApplicationId).FirstOrDefault();
public string GetHikerLongitude(string longitude) { Hiker hikerLongitude = _context.Hikers.Where(i => i.Latitude == longitude).FirstOrDefault(); return(hikerLongitude.Longitude); }
public string GetHikerState(string state) { Hiker hikerState = _context.Hikers.Where(i => i.SelectedState == state).FirstOrDefault(); return(hikerState.SelectedState); }
public string GetHikerCity(string city) { Hiker hikerCity = _context.Hikers.Where(i => i.City == city).FirstOrDefault(); return(hikerCity.City); }
public string GetHikerAddress(string address) { Hiker hikerAddress = _context.Hikers.Where(i => i.StreetAddress == address).FirstOrDefault(); return(hikerAddress.StreetAddress); }
public ActionResult Edit(int hikerId) { Hiker newHiker = Hiker.Find(hikerId); return(View(newHiker)); }
public void Roman_12_isXII() { Assert.AreEqual("XII", Hiker.getRoman(12)); }
public void Roman_4_isIV() { Assert.AreEqual("IV", Hiker.getRoman(4)); }
public void Roman_1_isI() { Assert.AreEqual("I", Hiker.getRoman(1)); }
public void Dispose() { Hiker.ClearAll(); }
public void test_the_real_thing() { Hiker douglas = new Hiker(new RealHelper()); Assert.That(douglas.AnswerFor(6), Is.EqualTo(42)); }
public void inactivarHiker(Hiker user) { conexionSQL.getInstance().inactivarHiker(user); }
public Hiker GetHikerRecord(int?id) => _context.Hikers.Where(i => i.HikerId == id).FirstOrDefault(); // not working public int GetHikerId(int id) { Hiker hikerId = _context.Hikers.Where(i => i.HikerId == id).FirstOrDefault(); return(hikerId.HikerId); }
public void Setup() { _numberOfDoors = 100; _hiker = new Hiker(_numberOfDoors); }
public string GetHikerFirstName(string firstName) // Overload for first name { Hiker hikerFirstName = _context.Hikers.Where(i => i.FirstName == firstName).FirstOrDefault(); return(hikerFirstName.FirstName); }
public string GetHikerLastName(string lastName) { Hiker hikerLastName = _context.Hikers.Where(i => i.LastName == lastName).FirstOrDefault(); return(hikerLastName.LastName); }
public void HikerConstructor_CreatesNewInstanceOfObject_Hiker() { Hiker newHiker = new Hiker("Test Name", "first", "last", 98105, "(803)234-5554", "*****@*****.**", 1, 1); Assert.AreEqual(typeof(Hiker), newHiker.GetType()); }
public static Dto.HikerDto ToDto(this Hiker hiker) { return(ReflectionHelper.Copy <Hiker, Dto.HikerDto>(hiker)); }
public void GetAll_HikersStartEmpty_HikerList() { int result = Hiker.GetAll().Count; Assert.AreEqual(0, result); }
public void Roman_3_isIII() { Assert.AreEqual("III", Hiker.getRoman(3)); }