예제 #1
0
        public async Task <IActionResult> PutProd(string id, Protarea Protarea)
        {
            if (id != Protarea.TAREAPROC)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <Protarea> > PostProd(Protarea Protarea)
        {
            _context.Protarea.Add(Protarea);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ProdExists(Protarea.TAREAPROC))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetProd", new { id = Protarea.TAREAPROC }, Protarea));
        }