Пример #1
0
        public async Task <ActionResult <PlaceKeep> > PostPlaceKeep(PlaceKeep placeKeep)
        {
            _context.PlaceKeep.Add(placeKeep);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPlaceKeep", new { id = placeKeep.Id }, placeKeep));
        }
Пример #2
0
        public async Task <IActionResult> PutPlaceKeep(int id, PlaceKeep placeKeep)
        {
            if (id != placeKeep.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }