Exemple #1
0
        public async Task <IActionResult> PutPosts(int id, Posts posts)
        {
            if (id != posts.PostsId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutBlogger(int id, Blogger blogger)
        {
            if (id != blogger.BlogId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public void UpdateBlog(Blogger blog)
 {
     context.Entry(blog).State = EntityState.Modified;
 }