Пример #1
0
        public async Task <IActionResult> PutEline(short id, Eline eline)
        {
            if (id != eline.ElineId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <Eline> > PostEline(Eline eline)
        {
            _context.Eline.Add(eline);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ElineExists(eline.ElineId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEline", new { id = eline.ElineId }, eline));
        }