public IActionResult Create([FromBody] BankDB.Model.Bank bank) { if (bank == null) { return(BadRequest()); } var newBank = BankUtilities.AddBank(bank.Name, bank.Bic); return(CreatedAtRoute("GetBank", new { id = newBank.Id }, bank)); }
public IActionResult Update(long id, [FromBody] BankDB.Model.Bank updatedBank) { if (updatedBank == null || updatedBank.Id != id) { return(BadRequest()); } var bank = BankUtilities.GetBanks().FirstOrDefault(b => b.Id == id); if (bank == null) { return(NotFound()); } bank.Name = updatedBank.Name; bank.Bic = updatedBank.Bic; BankUtilities.UpdateBank(bank.Id, bank.Name, bank.Bic); return(new NoContentResult()); }