コード例 #1
0
 public IHttpActionResult DeleteMovement(int id)
 {
     try
     {
         _service.Delete(id);
         return(Ok());
     }
     catch (ObjectNotFoundException e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
0
        public async Task <ActionResult> Delete(int Id)
        {
            try
            {
                await _service.Delete(Id);

                return(RedirectToAction(nameof(Index)));
            }
            catch (NotFoundException e)
            {
                TempData["ErrorMessage"] = e.Message;
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound, e.Message));
            }
            catch (DbUpdateException e)
            {
                TempData["ErrorMessage"] = e.Message;
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, e.Message));
            }
        }
コード例 #3
0
 public void Delete(string id = "3c3d9d1b-2168-4175-85b3-fb8d7a4062bc")
 {
     _movementService.Delete(new System.Guid(id));
 }