Ejemplo n.º 1
0
        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("./"));
        }
Ejemplo n.º 2
0
        public IActionResult OnPost(int locationId)
        {
            try
            {
                var location = locationData.Delete(locationId);
                locationData.Commit();

                if (location == null)
                {
                    return(RedirectToPage("./NotFound"));
                }

                TempData["Message"] = $"{location.Name} wurde gelöscht!";
                return(RedirectToPage("./List"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        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 }));
        }