public async Task <IActionResult> Add([FromBody] LancamentosDespesa lancamento) { await _repository.Add(lancamento); if (lancamento.Notifications.Count > 0) { return(BadRequest(new { error = lancamento.Notifications })); } return(CreatedAtAction("GetById", new { id = lancamento.Id }, lancamento)); }
public async Task <IActionResult> Update(int id, LancamentosDespesa LancamentoDespesa) { if (id != LancamentoDespesa.Id) { return(BadRequest()); } await _repository.Update(LancamentoDespesa); if (LancamentoDespesa.Notifications.Count > 0) { return(BadRequest(new { error = LancamentoDespesa.Notifications })); } return(NoContent()); }