Ejemplo n.º 1
0
 public ActionResult <bool> Delete(int id)
 {
     try
     {
         return(Ok(_repository.Delete(id)));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Error: Controller exception on  Delete(int id)");
         return(StatusCode((int)HttpStatusCode.InternalServerError, new { Error = ex.Message }));
     }
 }
Ejemplo n.º 2
0
        public IHttpActionResult Delete(int?id)
        {
            IHttpActionResult result;

            if (id != null)
            {
                repository.Delete((int)id);
                result = Ok();
            }
            else
            {
                result = StatusCode(HttpStatusCode.BadRequest);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public IActionResult DeleteConfirmed(int id)
        {
            repo.Delete(id);

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 4
0
 public async Task <IActionResult> DeleteConfirmed(int id)
 {
     IRepo.Delete(id);
     return(RedirectToAction(nameof(Index)));
 }