コード例 #1
0
        public async Task <IActionResult> PutTattribute(long id, Tattribute tattribute)
        {
            if (id != tattribute.TattributeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <Tattribute> > PostTattribute(Tattribute tattribute)
        {
            _context.Tattribute.Add(tattribute);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TattributeExists(tattribute.TattributeId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTattribute", new { id = tattribute.TattributeId }, tattribute));
        }