Exemple #1
0
        public async Task <IActionResult> PutEtrainDetectionElements(long id, EtrainDetectionElements etrainDetectionElements)
        {
            if (id != etrainDetectionElements.EtrainDetectionElementsId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <EtrainDetectionElements> > PostEtrainDetectionElements(EtrainDetectionElements etrainDetectionElements)
        {
            _context.EtrainDetectionElements.Add(etrainDetectionElements);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EtrainDetectionElementsExists(etrainDetectionElements.EtrainDetectionElementsId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEtrainDetectionElements", new { id = etrainDetectionElements.EtrainDetectionElementsId }, etrainDetectionElements));
        }