public async Task <ActionResult <DiveSite> > CreateDiveSite(DiveSite diveSite) { _context.DiveSites.Add(diveSite); await _context.SaveChangesAsync(); return(diveSite); }
public IActionResult UpdateSite(DiveSite thisdivesite) { int?diverid = HttpContext.Session.GetInt32("sessionid"); if (diverid != null) { if (ModelState.IsValid) { dbContext.Add(thisdivesite); dbContext.SaveChanges(); return(RedirectToAction("DisplaySites")); } } return(Redirect("/")); }
public IActionResult EditSite(int divesiteid) { int?diverid = HttpContext.Session.GetInt32("sessionid"); if (diverid != null) { if (ModelState.IsValid) { ViewBag.LoggedInDiver = dbContext.Divers.SingleOrDefault(d => d.DiverID == (int)diverid); DiveSite Site2Edit = dbContext.DiveSites.SingleOrDefault(s => s.DiveSiteID == divesiteid); return(View(Site2Edit)); } } return(Redirect("/")); }
public IActionResult CreateSite(DiveSite NewDiveSite) { int?diverid = HttpContext.Session.GetInt32("sessionid"); if (diverid != null) { if (ModelState.IsValid) { dbContext.Add(NewDiveSite); dbContext.SaveChanges(); return(RedirectToAction("AddDive")); } } return(Redirect("/")); }
public IActionResult SeedDB() { DiveSite DS1 = new DiveSite(); DS1.SiteName = "Meadows"; DS1.City = "Kaiua Kona"; DS1.StProv = "Hawaii"; DS1.Country = "USA"; DS1.Latitude = 19.611935; DS1.Longitude = -155.995750; DS1.Altitude = 0; DiveSite DS2 = new DiveSite(); DS2.SiteName = "3-Room Cave"; DS2.City = "Kaiua Kona"; DS2.StProv = "Hawaii"; DS2.Country = "USA"; DS2.Latitude = 19.611935; DS2.Longitude = -155.995750; DS2.Altitude = 0; DiveSite DS3 = new DiveSite(); DS3.SiteName = "Paradise Pinnacle"; DS3.City = "Captain Cook"; DS3.StProv = "Hawaii"; DS3.Country = "USA"; DS3.Latitude = 19.484941; DS3.Longitude = -155.958732; DS3.Altitude = 0; DiveSite DS4 = new DiveSite(); DS4.SiteName = "Au Au Crater"; DS4.City = "Pu'uhonua O Honaunau Park"; DS4.StProv = "Hawaii"; DS4.Country = "USA"; DS4.Latitude = 19.428509; DS4.Longitude = -155.931238; DS4.Altitude = 0; DiveSite DS5 = new DiveSite(); DS5.SiteName = "Black Coral Forest"; DS5.City = "Pu'uhonua O Honaunau Park"; DS5.StProv = "Hawaii"; DS5.Country = "USA"; DS5.Latitude = 19.388199; DS5.Longitude = -155.921268; DS5.Altitude = 0; DiveSite DS6 = new DiveSite(); DS6.SiteName = "Catacombs"; DS6.City = "Pu'uhonua O Honaunau Park"; DS6.StProv = "Hawaii"; DS6.Country = "USA"; DS6.Latitude = 19.379303; DS6.Longitude = -155.915243; DS6.Altitude = 0; DiveSite DS7 = new DiveSite(); DS7.SiteName = "Blue Lake"; DS7.City = "Cascade"; DS7.StProv = "Idaho"; DS7.Country = "USA"; DS7.Latitude = 44.409112; DS7.Longitude = 116.134790; DS7.Altitude = 7322; DiveSite DS8 = new DiveSite(); DS8.SiteName = "Lucky Peak"; DS8.City = "Boise"; DS8.StProv = "Idaho"; DS8.Country = "USA"; DS8.Latitude = 43.525157; DS8.Longitude = 116.054857; DS8.Altitude = 3054; dbContext.Add(DS1); dbContext.Add(DS2); dbContext.Add(DS3); dbContext.Add(DS4); dbContext.Add(DS5); dbContext.Add(DS6); dbContext.Add(DS7); dbContext.Add(DS8); dbContext.SaveChanges(); return(Redirect("displaylogs")); }
public async Task <ActionResult <DiveSite> > CreateDiveSite(DiveSite diveSite) { return(await _diveSiteService.CreateDiveSite(diveSite)); }
private void Awake() { e = gameObject.GetComponent <DiveSite>(); }