Exemplo n.º 1
0
        public async Task <IActionResult> PutEoperatingPeriod(short id, EoperatingPeriod eoperatingPeriod)
        {
            if (id != eoperatingPeriod.EoperatingPeriodId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <EoperatingPeriod> > PostEoperatingPeriod(EoperatingPeriod eoperatingPeriod)
        {
            _context.EoperatingPeriod.Add(eoperatingPeriod);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EoperatingPeriodExists(eoperatingPeriod.EoperatingPeriodId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEoperatingPeriod", new { id = eoperatingPeriod.EoperatingPeriodId }, eoperatingPeriod));
        }