public IActionResult OnPost() { if (ModelState.IsValid) { _locationData.Update(Location); return(RedirectToAction("Details", "Home", new { id = Location.Id })); } return(Page()); }
public IActionResult OnPost(long locationId) { var updatedLocation = locationData.Get(locationId); updatedLocation.TimeEntries.Add(new TimeEntry { Arrival = DateTime.Now }); locationData.Update(locationId, updatedLocation); locationData.Commit(); return(Redirect("./")); }
public async Task <IActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } if (Location.Id > 0) { var googleUrl = await googleGeocodingService.GoogleApiDingens(Location); locationData.Update(Location); } else { var googleUrl = await googleGeocodingService.GoogleApiDingens(Location); locationData.Add(Location); } locationData.Commit(); TempData["Message"] = "Location gespeichert!"; return(RedirectToPage("./Detail", new { locationId = Location.Id })); }