Exemplo n.º 1
0
        public async Task <IActionResult> PutTannotationText(long id, TannotationText tannotationText)
        {
            if (id != tannotationText.TannotationTextId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <TannotationText> > PostTannotationText(TannotationText tannotationText)
        {
            _context.TannotationText.Add(tannotationText);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TannotationTextExists(tannotationText.TannotationTextId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTannotationText", new { id = tannotationText.TannotationTextId }, tannotationText));
        }