Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Topics> > GetTopicDetails(int id)
        {
            var topics = await _context.Topics.SingleAsync(t => t.TopicId == Convert.ToInt32(id));

            _context.Entry(topics)
            .Collection(topic => topic.Contain)
            .Query()
            .Include(con => con.Keyword)
            .Load();

            if (topics == null)
            {
                return(NotFound());
            }

            return(topics);
        }