public IActionResult DeleteConfirmed(int id) { try { _measurementRepository.DeleteMeasurement(id); } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", "Delete failed. Try again, and if the problem persists " + "see your system administrator."); } return(RedirectToAction("Index")); }
public IActionResult DeleteMeasurement([FromRoute] long id) { _measurementRepository.DeleteMeasurement(id, HttpContext.User.Identity.Name); return(StatusCode(200, new { statusCode = 200, message = "deleted" })); }
public void DeleteMeasurement(string userId, int measurementId) { _repository.DeleteMeasurement(userId, measurementId); }