コード例 #1
0
 public static bool CancelContractScopeIsValid(this Contract contract, CancelContractCommand command)
 {
     return(AssertionConcern.IsSatisfiedBy(
                //AssertionConcern.AssertNotEmpty(command.Note, "É preciso informar o motivo do cancelamento do contrato"),
                //AssertionConcern.AssertLength(command.Note, 8, 2000, "Tamanho do texto inválido")
                ));
 }
コード例 #2
0
        public Task <HttpResponseMessage> Cancel([FromBody] dynamic body)
        {
            var command = new CancelContractCommand(
                idContract: (int)body.idContract,
                idCompany: (int)body.idCompany,
                //idPlan: (int)body.idPlan,
                note: (string)body.note
                );

            var contract = _service.Cancel(command);

            return(CreateResponse(HttpStatusCode.OK, contract));
        }
コード例 #3
0
        public void CancelContract(CancelContractCommand command)
        {
            if (!this.CancelContractScopeIsValid(command))
            {
                return;
            }

            this.IdCompany = command.IdContract;
            //this.IdPlan = command.IdPlan;
            this.DateEnd        = command.DateEnd;
            this.StatusContract = command.StatusContract;
            this.Note           = command.Note;
        }
        public Contract Cancel(CancelContractCommand command)
        {
            var contract = _repository.GetById(command.IdContract);

            contract.CancelContract(command);

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

            return(null);
        }