예제 #1
0
        public async Task <IActionResult> PutEblocks(long id, Eblocks eblocks)
        {
            if (id != eblocks.EblocksId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <Eblocks> > PostEblocks(Eblocks eblocks)
        {
            _context.Eblocks.Add(eblocks);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EblocksExists(eblocks.EblocksId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEblocks", new { id = eblocks.EblocksId }, eblocks));
        }