Exemple #1
0
        public async Task <IActionResult> PutEcrossedElements(long id, EcrossedElements ecrossedElements)
        {
            if (id != ecrossedElements.EcrossedElementsId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <EcrossedElements> > PostEcrossedElements(EcrossedElements ecrossedElements)
        {
            _context.EcrossedElements.Add(ecrossedElements);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EcrossedElementsExists(ecrossedElements.EcrossedElementsId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEcrossedElements", new { id = ecrossedElements.EcrossedElementsId }, ecrossedElements));
        }