示例#1
0
        public async Task <ActionResult <TaskTestTopic> > PostTaskTestTopic(TaskTestTopic task_test_topic)
        {
            _context.TaskTestTopic.Add(task_test_topic);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTaskTestTopic", new { id = task_test_topic.TaskTestTopicId }, task_test_topic));
        }
示例#2
0
        public async Task <IActionResult> PutTaskTestTopic(int id, TaskTestTopic task_test_topic)
        {
            //if (id != task_test_topic.TaskTestTopicId)
            //{
            //    return BadRequest();
            //}

            task_test_topic.TaskTestTopicId = id;

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

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

            return(NoContent());
        }