예제 #1
0
        public async Task <IActionResult> Putmainconfig([FromRoute] int id, [FromBody] mainconfig mainconfig)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> Postmainconfig([FromBody] mainconfig mainconfig)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.mainconfig.Add(mainconfig);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getmainconfig", new { id = mainconfig.id }, mainconfig));
        }