Пример #1
0
        public IActionResult PostRateChartItem([FromBody] RateChartItem rateChartItem)
        {
            _repository.SaveRate(rateChartItem);


            return(CreatedAtAction("GetRateChartItem", new { id = rateChartItem.RateId }, rateChartItem));
        }
Пример #2
0
        public void EditRate(RateChartItem rateChartItem)
        {
            _context.Entry(rateChartItem).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        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());
        }
Пример #4
0
 public void DeleteRate(RateChartItem rateChartItem)
 {
     _context.RateCharts.Remove(rateChartItem);
     _context.SaveChanges();
 }
Пример #5
0
 public void SaveRate(RateChartItem rateChartItem)
 {
     _context.RateCharts.Add(rateChartItem);
     _context.SaveChanges();
 }