Beispiel #1
0
        public async Task <ActionResult <CpoRequest> > PostCpoRequest(CpoRequest cpoRequest)
        {
            _context.CpoRequest.Add(cpoRequest);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCpoRequest", new { id = cpoRequest.Idrequest }, cpoRequest));
        }
Beispiel #2
0
        public async Task <IActionResult> PutCpoRequest(long id, CpoRequest cpoRequest)
        {
            if (id != cpoRequest.Idrequest)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }