Exemplo n.º 1
0
        public async Task <IActionResult> PutRequest_Lines(int id, Request_Lines request_Lines)
        {
            if (id != request_Lines.Id)
            {
                return(BadRequest());
            }

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

            try {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException) {
                if (!Request_LinesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            RecalculateTotal(request_Lines.RequestId);

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Request_Lines> > PostRequest_Lines(Request_Lines request_Lines)
        {
            _context.Request_Lines.Add(request_Lines);

            await _context.SaveChangesAsync();

            RecalculateTotal(request_Lines.RequestId);

            return(CreatedAtAction("GetRequest_Lines", new { id = request_Lines.Id }, request_Lines));
        }