Esempio n. 1
0
        public async Task <IActionResult> PutMstDomain([FromRoute] int id, [FromBody] MstDomain mstDomain)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PostMstDomain([FromBody] MstDomain mstDomain)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MstDomain.Add(mstDomain);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMstDomain", new { id = mstDomain.DomainId }, mstDomain));
        }