public async Task <IActionResult> PutKeywords(int id, Keywords keywords)
        {
            if (id != keywords.KeywordId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutTopics(int id, Topics topics)
        {
            if (id != topics.TopicId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#3
0
        public async Task <ActionResult <Contain> > PostContain(Contain contain)
        {
            _context.Contain.Add(contain);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ContainExists(contain.TopicId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetContain", new { id = contain.TopicId }, contain));
        }