public IActionResult AddParkToBuckList(string name, string city, string state, string latitude, string longitude, string url, string parkcode, string visited) { string id = User.FindFirst(ClaimTypes.NameIdentifier).Value; UserParks park = new UserParks(); park.ParkName = name; park.City = city; park.State = state; park.Latitude = latitude; park.Longitude = longitude; park.Url = url; park.ParkVisited = false; park.ParkCode = parkcode; park.CurrentUserId = id; if (visited == "true") { park.ParkVisited = true; } if (ModelState.IsValid) { _context.UserParks.Add(park); _context.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public IActionResult MarkAsScheduled(int id) { UserParks found = _context.UserParks.Where(x => x.UsersParkIds == id).First(); found.ParkVisited = null; _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(found); _context.SaveChanges(); return(RedirectToAction("CheckUserPrefs")); }
public IActionResult UpdateParkVisited(int id) { string Userid = User.FindFirst(ClaimTypes.NameIdentifier).Value; UserParks found = _context.UserParks.Where(x => x.UsersParkIds == id).First(); found.ParkVisited = true; _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(found); _context.SaveChanges(); return(RedirectToAction("parksVisited")); }
public IActionResult RemoveFromBucketList(int id) { var FullList = new Parks(); UserParks found = _context.UserParks.Where(x => x.UsersParkIds == id).First(); if (found != null) { _context.UserParks.Remove(found); _context.SaveChanges(); } return(RedirectToAction("DisplayBucketList")); }