public IActionResult Create(Trail trail) { System.Console.WriteLine(trail.Name); System.Console.WriteLine(trail.Description); trailFactory.Add(trail); return(RedirectToAction("Index")); }
public IActionResult Create(Trail trail) { if (ModelState.IsValid) { _trailFactory.Add(trail); return(RedirectToAction("Trails")); } return(View("Add")); }
public IActionResult CreateTrail(Trail form) { if (tr == null) { tr = new TrailFactory(); } tr.Add(form); return(RedirectToAction("Index")); }
public IActionResult New(Trail form) { if (ModelState.IsValid) { _TrailFactory.Add(form); return(RedirectToAction("Index")); } return(View("NewForm")); }
public IActionResult Add(Trail trail) { if (!ModelState.IsValid) { return(View("New")); } trailFactory.Add(trail); return(RedirectToAction("Index")); }
public IActionResult Process(Trail data) { if (ModelState.IsValid) { trailFactory.Add(data); return(RedirectToAction("Index")); } return(View("NewTrail")); }
public IActionResult CreateTrail(Trail trail) { if (ModelState.IsValid) { _trailFactory.Add(trail); return(RedirectToAction("Index")); } return(View("NewTrail")); }
public IActionResult CreateTrail(Trail trail) { if (ModelState.IsValid) { trailFactory.Add(trail); // return Json(trail); // For debugging purposes! No return required. } return(View("NewTrail")); }
public IActionResult AddTrail(Trail newTrail) { if (ModelState.IsValid) { trailFactory.Add(newTrail); return(RedirectToAction("Index")); } ViewBag.Errors = ModelState.Values; // NEED to add errors to View return(View()); }
public IActionResult Add(Trail NewTrail) { if (ModelState.IsValid) { trailFactory.Add(NewTrail); System.Console.WriteLine("write stuff"); return(RedirectToAction("Index")); } return(View("NewTrail")); }
public IActionResult AddNew(Trail trail) { if (ModelState.IsValid) { trailFactory.Add(trail); return(RedirectToAction("Index")); } return(View("AddTrail")); }
public IActionResult Create(Trail trail) { TryValidateModel(trail); if (ModelState.IsValid) { trailFactory.Add(trail); return(RedirectToAction("Index")); } return(View("Create")); }
public IActionResult newTrailCreate(Trail trail) { System.Console.WriteLine("top of create"); if (ModelState.IsValid) { trailFactory.Add(trail); System.Console.WriteLine("here"); return(RedirectToAction("Index")); } System.Console.WriteLine("bottom of create"); return(View("newTrail")); }
public IActionResult Create(Trail newTrail) { if (ModelState.IsValid) { _trailFactory.Add(newTrail); return(RedirectToAction("Index")); } else { return(View("NewTrail", newTrail)); } }
public IActionResult Create(TrailModel submission) { if (ModelState.IsValid) { trailFactory.Add(submission); return(RedirectToAction("Index")); } else { return(View("NewTrail")); } }
public IActionResult Create(Trail item) { if (ModelState.IsValid) { trailFactory.Add(item); return(RedirectToAction("Index")); } else { return(View("add", item)); } }
public IActionResult Create(Trail newTrail) { if (ModelState.IsValid) { trailFactory.Add(newTrail); return(Redirect("/")); } else { return(View("NewTrail")); } }
public IActionResult ProcessAdd(LostWoods.Models.Trail newTrail) { if (ModelState.IsValid) { _trailFactory.Add(newTrail); return(RedirectToAction("Index")); } else { return(View("NewTrail")); } }
public IActionResult CreateTrail(TrailInfo trailInfo) { if (ModelState.IsValid) { trailFactory.Add(trailInfo); return(RedirectToAction("Index")); } else { return(View("NewTrail")); } }
public IActionResult CreateTrailProcess(Trail newTrail) { if (ModelState.IsValid) { trailFactory.Add(newTrail); return(RedirectToAction("Index")); } else { ViewBag.Errors = "Please fill out the fields completely!"; return(View("Add")); } }
public IActionResult createTrail(Trail trail) { TryValidateModel(trail); if (ModelState.IsValid) { trailFactory.Add(trail); return(RedirectToAction("Index")); //change RTA to a return view } else { return(View("addTrail")); } }
public IActionResult addTrail(Trail trail) { if (ModelState.IsValid) { trailFactory.Add(trail); } var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .Select(z => z[0].ErrorMessage.ToString()) .ToList(); TempData["error_list"] = errors; return(RedirectToAction("aNewTrail")); }
public IActionResult Create(Trail Trail) { if (ModelState.IsValid != true) { // failed validations return(View("New")); } else { // add trail to db _TrailFactory.Add(Trail); return(RedirectToAction("Index")); } }
public IActionResult process(Trail trail) { if (ModelState.IsValid) { Console.WriteLine("THERE WERE NO ERRORS!"); trailFactory.Add(trail); return(Redirect("/")); } else { Console.WriteLine("THERE WAS ERRORS IN YOUR FORM!"); return(View("addTrail", trail)); } }
public IActionResult AddTrail(TrailViewModel model) { if (ModelState.IsValid) { var Trail = new Trail { name = model.name, length = model.length, elev_change = model.elev_change, longitude = model.longitude, latitude = model.latitude, description = model.description, }; trailFactory.Add(Trail); return(RedirectToAction("Index")); } return(View("AddForm", model)); }
public IActionResult Add(TrailViewModel newTrail) { if (ModelState.IsValid) { Trail trail = new Trail { Name = newTrail.Name, Description = newTrail.Description, Length = newTrail.Length, Elevation = newTrail.Elevation, Latitude = newTrail.Latitude, Longitude = newTrail.Longitude }; trailFactory.Add(trail); return(RedirectToAction("Index")); } return(View("NewTrail")); }
public IActionResult Add(RegisterViewModel model) { if (ModelState.IsValid) { Trail trail = new Trail { name = model.name, length = model.length, description = model.description, elevation = model.elevation, latitude = model.latitude, longitude = model.longitude }; trailfactory.Add(trail); return(RedirectToAction("Index")); } ViewBag.errors = ModelState.Values; return(View("New")); }
public IActionResult AddTrail(Trail t, string NS, string EW) { if (NS == "S" && t.Latitude > 0) { t.Latitude = t.Latitude * -1; } if (EW == "W" && t.Longitude > 0) { t.Longitude = t.Longitude * -1; } if (ModelState.IsValid) { trailFactory.Add(t); return(RedirectToAction("Index")); } else { return(View("NewTrail")); } }
public IActionResult Store(Trail model) { if (ModelState.IsValid) { //List<Dictionary<string, object>> User = _dbConnector.Query($"INSERT INTO users (first_name, last_name, email, password, age) VALUES ('{model.FirstName}', '{model.LastName}', '{model.Email}', '{model.Password}', 0)"); trailFactory.Add(model); return(RedirectToAction("Index")); } else { string messages = string.Join("; ", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)); Console.WriteLine(messages); HttpContext.Session.SetObjectAsJson("TheList", ModelState.Values); return(RedirectToAction("NewTrail")); } //List<Dictionary<string, object>> Allq = _dbConnector.Query("SELECT * FROM quotes ORDER BY created_at Desc"); }
public IActionResult AddTrail(NewTrailViewModel trail) { if (ModelState.IsValid) { Console.WriteLine("ModelState is valid."); Trail NewTrail = new Trail { TrailName = trail.TrailName, Description = trail.Description, TrailLength = trail.TrailLength, ElevationGain = trail.ElevationGain, Lattitude = trail.Lattitude, Longitude = trail.Longitude }; trailFactory.Add(NewTrail); } else { ViewBag.errors = ModelState.Values; return(View()); } return(RedirectToAction("Index")); }