public IActionResult PostRateChartItem([FromBody] RateChartItem rateChartItem) { _repository.SaveRate(rateChartItem); return(CreatedAtAction("GetRateChartItem", new { id = rateChartItem.RateId }, rateChartItem)); }
public void EditRate(RateChartItem rateChartItem) { _context.Entry(rateChartItem).State = EntityState.Modified; try { _context.SaveChanges(); } catch (Exception) { throw; } }
public IActionResult PutRateChartItem(int id, [FromBody] RateChartItem rateChartItem) { if (id != rateChartItem.RateId) { return(BadRequest()); } try { _repository.EditRate(rateChartItem); } catch (DbUpdateConcurrencyException) { if (!_repository.RateChartItemExists(id)) { return(NotFound()); } else { return(StatusCode(500, "Internal Server error has occurred!")); } } return(NoContent()); }
public void DeleteRate(RateChartItem rateChartItem) { _context.RateCharts.Remove(rateChartItem); _context.SaveChanges(); }
public void SaveRate(RateChartItem rateChartItem) { _context.RateCharts.Add(rateChartItem); _context.SaveChanges(); }