public IHttpActionResult Delete(int id)
        {
            Checkpoint item = service.GetSimple(id);

            if (item != null)
            {
                service.DeleteAllAdmission(id);
                service.Delete(item);
                return(Ok(item));
            }
            return(BadRequest());
        }
 public ActionResult Delete(CheckpointDTO model)
 {
     try
     {
         checkpointService.DeleteAllAdmission(model.ID);
         checkpointService.Delete(checkpointService.GetSimple(model.ID));
         return(RedirectToAction("Index", "Checkpoint"));
     }
     catch
     {
         return(View(model));
     }
 }
        public void Delete_All_Admission()
        {
            //Arrange
            int checkpointID = -1;

            unitWorkMoq.Setup(x => x.CheckpointAdmission.GetAll()).Returns(itemsCheckpointAdmission);
            unitWorkMoq.Setup(x => x.CheckpointAdmission.Delete(It.IsAny <int>())).Callback((int callbackID) =>
            {
                checkpointID = itemsSimple[0].ID;
            });

            //Act
            serviceMock.DeleteAllAdmission(itemsSimple[0].ID);

            //Assert
            Assert.AreNotEqual(-1, checkpointID);
            Assert.AreEqual(id, checkpointID);
        }