コード例 #1
0
        public async Task <ActionResult <QandA_Kategory> > PostQandA_Kategory(QandA_Kategory qandA_Kategory)
        {
            _context.QandA_Kategorys.Add(qandA_Kategory);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetQandA_Kategory", new { id = qandA_Kategory.Id }, qandA_Kategory));
        }
コード例 #2
0
        public async Task <IActionResult> PutQandA_Kategory(long id, QandA_Kategory qandA_Kategory)
        {
            if (id != qandA_Kategory.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }