Пример #1
0
        public async Task <IActionResult> PutTgauge(long id, Tgauge tgauge)
        {
            if (id != tgauge.TgaugeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <Tgauge> > PostTgauge(Tgauge tgauge)
        {
            _context.Tgauge.Add(tgauge);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TgaugeExists(tgauge.TgaugeId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTgauge", new { id = tgauge.TgaugeId }, tgauge));
        }