Пример #1
0
        public async Task <ActionResult <FollowedShops> > PostFollowedShops(FollowedShops followedShops)
        {
            _context.FollowedShops.Add(followedShops);
            await _context.SaveChangesAsync();

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

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

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

            return(NoContent());
        }