Пример #1
0
        public void CanDeleteRequest()
        {
            // Establish Context
            var requestToDelete = new Request();

            _requestRepository.Expect(r => r.Get(1))
            .Return(requestToDelete);

            // Act
            ActionConfirmation confirmation =
                _requestManagementService.Delete(1);

            // Assert
            confirmation.ShouldNotBeNull();
            confirmation.WasSuccessful.ShouldBeTrue();
            confirmation.Value.ShouldBeNull();
        }
Пример #2
0
        public ActionResult Delete(int id)
        {
            ActionConfirmation deleteConfirmation = _requestManagementService.Delete(id);

            TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] =
                deleteConfirmation.Message;
            //return RedirectToAction("Index");
            return(RedirectToAction("Search"));
        }
 public IActionResult DeleteRequest(int?id)
 {
     if (id == null)
     {
         return(RedirectToAction(nameof(Requests)));
     }
     else
     {
         requestsManagementService.Delete((int)id);
         return(RedirectToAction(nameof(Requests)));
     }
 }
Пример #4
0
        public Result <int> Delete(int id)
        {
            RequestDTO request = requestManagementService.GetById(id);

            if (request == null)
            {
                return new Result <int>()
                       {
                           MessageType = MessageType.NotFound, MessageText = $"Request with id {id} was not found"
                       }
            }
            ;

            requestManagementService.Delete(id);
            return(new Result <int>(id)
            {
                MessageType = MessageType.Ok, MessageText = $"Request with ID {id} was successfully deleted"
            });
        }
    }