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

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutTicket(int id, Ticket ticket)
        {
            if (id != ticket.id)
            {
                return(BadRequest());
            }

            //// update point
            //_context.Points.Update(ticket.From);
            //_context.Points.Update(ticket.To);

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

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

            return(NoContent());
        }