public AdvancedPaymentDomain Serialize(AdvancedPaymentDomain advancedPaymentDomain) { advancedPaymentDomain.RequestedOn = DateTime.Now; advancedPaymentDomain.StatusRequest = "pending"; advancedPaymentDomain.AmountRequestedList = AmountRequestedList; return(advancedPaymentDomain); }
public async Task <IActionResult> Analyzed([FromServices] AdvancedPaymentDomain advancedPaymentDomain, [FromBody] AntecipatedAnalyzeViewModel antecipatedAnalyzeViewModel) { antecipatedAnalyzeViewModel.Serialize(advancedPaymentDomain); var result = await advancedPaymentDomain.UpdateAntecipateToAnalyzed(); if (!result) { return(UnprocessableEntity(new { Error = "Antecipação não existe ou não pode ser alterada" })); } return(Ok()); }
public async Task <IActionResult> Create([FromServices] AdvancedPaymentDomain advancedPaymentDomain, [FromBody] AdvancedPaymentViewModel advancedPaymentViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState.Values)); } advancedPaymentViewModel.Serialize(advancedPaymentDomain); if (!await advancedPaymentDomain.Advanced()) { return(UnprocessableEntity(new { Error = "Falha ao registrar antecipação" })); } return(Ok(advancedPaymentDomain.AdvancedPayment)); }
public AdvancedPaymentDomain Serialize(AdvancedPaymentDomain advancedPaymentDomain) { advancedPaymentDomain.Id = Id.Value; return(advancedPaymentDomain); }