コード例 #1
0
        public async Task <IActionResult> PutTickets(int id, datamodels.Tickets tickets)
        {
            if (id != tickets.CodTicket)
            {
                return(BadRequest());
            }

            try
            {
                var mapaux = _mapper.Map <datamodels.Tickets, data.Tickets>(tickets);
                new CRPass.BS.Tickets(_context).Update(mapaux);
            }
            catch (Exception ee)
            {
                if (!TicketsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <datamodels.Tickets> > PostTickets(datamodels.Tickets tickets)
        {
            var mapaux = _mapper.Map <datamodels.Tickets, data.Tickets>(tickets);

            new CRPass.BS.Tickets(_context).Insert(mapaux);

            return(CreatedAtAction("GetTickets", new { id = tickets.CodTicket }, tickets));
        }