コード例 #1
0
        public async Task <IActionResult> PutMThrmsinventory([FromRoute] long id, [FromBody] MThrmsinventory mThrmsinventory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mThrmsinventory.MThrmsinventory1)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PostMThrmsinventory([FromBody] MThrmsinventory mThrmsinventory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MThrmsinventory.Add(mThrmsinventory);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMThrmsinventory", new { id = mThrmsinventory.MThrmsinventory1 }, mThrmsinventory));
        }