Example #1
0
        public async Task <IActionResult> PutPostsTags(Guid id, PostsTags postsTags)
        {
            if (id != postsTags.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <PostsTags> > PostPostsTags(PostsTags postsTags)
        {
            _context.PostsTags.Add(postsTags);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPostsTags", new { id = postsTags.Id }, postsTags));
        }
 public IActionResult Create(PostsTags postsTags)
 {
     _db.PostsTags.Add(postsTags);
     _db.SaveChanges();
     return(RedirectToAction("Index", "Pictures"));
 }