示例#1
0
        public async Task <IActionResult> PutLocationRestaurant(int id, LocationRestaurant locationRestaurant)
        {
            if (id != locationRestaurant.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <LocationRestaurant> > PostLocationRestaurant(LocationRestaurant locationRestaurant)
        {
            _context.LocationRest.Add(locationRestaurant);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLocationRestaurant", new { id = locationRestaurant.Id }, locationRestaurant));
        }