public async Task <IHttpActionResult> PuteventTicket(int id, eventTicket eventTicket)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eventTicket.eventCode)
            {
                return(BadRequest());
            }

            db.Entry(eventTicket).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> GeteventTicket(int id)
        {
            eventTicket eventTicket = await db.eventTickets.FindAsync(id);

            if (eventTicket == null)
            {
                return(NotFound());
            }

            return(Ok(eventTicket));
        }
        public async Task <IHttpActionResult> PosteventTicket(eventTicket eventTicket)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.eventTickets.Add(eventTicket);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = eventTicket.eventCode }, eventTicket));
        }
        public async Task <IHttpActionResult> DeleteeventTicket(int id)
        {
            eventTicket eventTicket = await db.eventTickets.FindAsync(id);

            if (eventTicket == null)
            {
                return(NotFound());
            }

            db.eventTickets.Remove(eventTicket);
            await db.SaveChangesAsync();

            return(Ok(eventTicket));
        }