public async Task <IActionResult> PostExchangeRateByCustomer([FromBody] ExchangeRateByCustomer exchangeRateByCustomer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ExchangeRateByCustomers.Add(exchangeRateByCustomer); await _context.SaveChangesAsync(); return(CreatedAtAction("GetExchangeRateByCustomer", new { id = exchangeRateByCustomer.Id }, exchangeRateByCustomer)); }
public async Task <IActionResult> PutExchangeRateByCustomer([FromRoute] int id, [FromBody] ExchangeRateByCustomer exchangeRateByCustomer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != exchangeRateByCustomer.Id) { return(BadRequest()); } _context.Entry(exchangeRateByCustomer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExchangeRateByCustomerExists(id)) { return(NotFound()); } else { throw; } } return(Ok(_context.ExchangeRateByCustomers.Find(id))); }