public async Task <IActionResult> Create(DraftContract contract)
        {
            if (ModelState.IsValid == false)
            {
                return(View(contract));
            }
            var toSave = new Core.Domain.Model.Contract()
            {
                Currency = contract.Currency.Value,
                Name     = contract.Name,
                Note     = contract.Note,
                Type     = contract.Type.Value
            };

            var saved = contractRepository.Add(toSave);
            await contractRepository.Save();

            draftRepository.Add(new ContractDraft()
            {
                ContractId = saved.Id, Step = 1
            });
            await draftRepository.Save();

            return(RedirectToAction("Step", new { contractId = saved.Id }));
        }
Exemplo n.º 2
0
 protected override void TakeFormAction()
 {
     if (CurrentActivity().CurrAction.FormDataProcessing.IsSaveRequestData)
     {
         var ContractDraft = WorkflowInstance.ContractDraft;
         var oEntity       = contractDraftRepo.Get(p => p.RequestHeaderId == RequestHeader.Id);
         if (oEntity == null)
         {
             var nEntity = WorkflowInstance.ContractDraft;
             nEntity.RequestHeaderId = RequestHeader.Id;
             contractDraftRepo.Add(nEntity);
         }
         else
         {
             oEntity.RequestHeaderId   = RequestHeader.Id;
             oEntity.Name              = ContractDraft.Name;
             oEntity.Vat               = ContractDraft.Vat;
             oEntity.Address           = ContractDraft.Address;
             oEntity.Email             = ContractDraft.Email;
             oEntity.RegistrationNo    = ContractDraft.RegistrationNo;
             oEntity.Phone             = ContractDraft.Phone;
             oEntity.ContactName       = ContractDraft.ContactName;
             oEntity.Position          = ContractDraft.Position;
             oEntity.IssueedBy         = ContractDraft.IssueedBy;
             oEntity.Term              = ContractDraft.Term;
             oEntity.StartDate         = ContractDraft.StartDate;
             oEntity.InclusiveTax      = ContractDraft.InclusiveTax;
             oEntity.EndingDate        = ContractDraft.EndingDate;
             oEntity.PaymentTerm       = ContractDraft.PaymentTerm;
             oEntity.AtSa              = ContractDraft.AtSa;
             oEntity.AtSpa             = ContractDraft.AtSpa;
             oEntity.AtLa              = ContractDraft.AtLa;
             oEntity.AtCa              = ContractDraft.AtCa;
             oEntity.AtLea             = ContractDraft.AtLea;
             oEntity.AtEa              = ContractDraft.AtEa;
             oEntity.AtOther           = ContractDraft.AtOther;
             oEntity.StatusNew         = ContractDraft.StatusNew;
             oEntity.StatusRenewal     = ContractDraft.StatusRenewal;
             oEntity.StatusReplacement = ContractDraft.StatusReplacement;
             oEntity.StatusAddendum    = ContractDraft.StatusAddendum;
             oEntity.Vis               = ContractDraft.Vis;
             oEntity.IsCapex           = ContractDraft.IsCapex;
             oEntity.BcjNumber         = ContractDraft.BcjNumber;
             oEntity.ActA              = ContractDraft.ActA;
             oEntity.ActB              = ContractDraft.ActB;
             oEntity.ActC              = ContractDraft.ActC;
             oEntity.ActD              = ContractDraft.ActD;
             contractDraftRepo.Update(oEntity);
         }
     }
 }