コード例 #1
0
        public void ShouldReturnValidWhenDeleteCommandIsValid()
        {
            var command = new DeleteEquipmentCommand();

            command.Id = Guid.NewGuid();
            var result = _handler.Handle(command);

            Assert.AreEqual(true, result.Status);
        }
        public Task <HttpResponseMessage> Delete(int id)
        {
            //var company = _service.Delete(id);
            var command = new DeleteEquipmentCommand(
                idEquipment: id
                );

            var equipment = _service.Delete(command);

            return(CreateResponse(HttpStatusCode.OK, equipment));
        }
コード例 #3
0
 public void Delete(DeleteEquipmentCommand command)
 {
     _db.Connection().Execute(
         "spDeleteEquipment",
         new
     {
         id = command.Id
     },
         commandType: CommandType.StoredProcedure
         );
 }
        public Equipment Delete(DeleteEquipmentCommand command)
        {
            var equipment = _repository.GetById(command.IdEquipment);

            equipment.Delete();
            _repository.Delete(equipment);

            if (Commit())
            {
                return(equipment);
            }

            return(null);
        }
コード例 #5
0
        public ICommandResult Handle(DeleteEquipmentCommand command)
        {
            string id = command.Id.ToString();

            if (string.IsNullOrEmpty(id))
            {
                AddNotification("Id", "Identificador inválido");
            }

            if (Invalid)
            {
                return(new CommandResult(false, "Erro ao deletar registro", Notifications));
            }

            _repository.Delete(command);
            return(new CommandResult(true, "Registro deletado com sucesos", null));
        }
コード例 #6
0
 public ICommandResult Delete(DeleteEquipmentCommand command)
 {
     return(_handler.Handle(command));
 }
コード例 #7
0
 public void Delete(DeleteEquipmentCommand command)
 {
 }