Example #1
0
        public async Task <ActionResult <FareClass> > PostFareClass(FareClass fareClass)
        {
            _context.FareClass.Add(fareClass);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFareClass", new { id = fareClass.Id }, fareClass));
        }
Example #2
0
        public async Task <IActionResult> PutFareClass(int id, FareClass fareClass)
        {
            if (id != fareClass.Id)
            {
                return(BadRequest());
            }

            _context.Entry(fareClass).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FareClassExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }