Exemple #1
0
        public async Task <IActionResult> OnPost(int measurementKeyId)
        {
            var measurementKey = await _measurementKeyData.Delete(measurementKeyId);

            await _measurementKeyData.Commit();

            if (measurementKey == null)
            {
                return(RedirectToPage("./Error"));
            }
            TempData["Message"] = $"{measurementKey.Name} deleted.";
            return(RedirectToPage("./MeasurementKeyList"));
        }
Exemple #2
0
        public async Task <IActionResult> OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (MeasurementKey.MeasurementKeyId > 0)
            {
                await _measurementKeyData.Update(MeasurementKey);
            }
            else
            {
                await _measurementKeyData.Add(MeasurementKey);
            }
            await _measurementKeyData.Commit();

            TempData["Message"] = "Measurement Key saved!";
            return(RedirectToPage("./MeasurementKeyDetails", new { measurementKeyId = MeasurementKey.MeasurementKeyId })); // Post-Redirect-Get pattern to avoid refreshing a post
        }