public async Task <ActionResult <PagamentoDespesa> > PostPagamentoDespesa(PagamentoDespesa pagamentoDespesa) { await _repository.Add(pagamentoDespesa); if (pagamentoDespesa.Notifications.Count > 0) { return(BadRequest(new { erro = pagamentoDespesa.Notifications })); } return(CreatedAtAction(nameof(GetById), new { id = pagamentoDespesa.Id }, pagamentoDespesa)); }
public async Task <IActionResult> PutPagamentoDespesa(int id, PagamentoDespesa pagamentoDespesa) { if (id != pagamentoDespesa.Id) { return(BadRequest()); } await _repository.Update(pagamentoDespesa); if (pagamentoDespesa.Notifications.Count > 0) { return(BadRequest(new { error = pagamentoDespesa.Notifications })); } return(NoContent()); }