Beispiel #1
0
        public async Task <ActionResult <FastFoodChain> > PostFastFoodChain(FastFoodChain fastFoodChain)
        {
            _context.FastFoodChain.Add(fastFoodChain);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFastFoodChain", new { id = fastFoodChain.Id }, fastFoodChain));
        }
Beispiel #2
0
        public async Task <IActionResult> PutFastFoodChain(int id, FastFoodChain fastFoodChain)
        {
            if (id != fastFoodChain.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }