Exemplo n.º 1
0
        public async Task <IActionResult> PutEcrossSections(long id, EcrossSections ecrossSections)
        {
            if (id != ecrossSections.EcrossSectionsId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <EcrossSections> > PostEcrossSections(EcrossSections ecrossSections)
        {
            _context.EcrossSections.Add(ecrossSections);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EcrossSectionsExists(ecrossSections.EcrossSectionsId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEcrossSections", new { id = ecrossSections.EcrossSectionsId }, ecrossSections));
        }