public IHttpActionResult PostAccountToEvent(AccountToEvent accountToEvent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AccountToEvent.Add(accountToEvent);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (AccountToEventExists(accountToEvent.Event_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = accountToEvent.Event_ID }, accountToEvent));
        }
        public IHttpActionResult PutAccountToEvent(int id, AccountToEvent accountToEvent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != accountToEvent.Event_ID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccountToEventExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetAccountToEvent(int id)
        {
            AccountToEvent accountToEvent = db.AccountToEvent.Find(id);

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

            return(Ok(accountToEvent));
        }
        public IHttpActionResult DeleteAccountToEvent(int id)
        {
            AccountToEvent accountToEvent = db.AccountToEvent.Find(id);

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

            db.AccountToEvent.Remove(accountToEvent);
            db.SaveChanges();

            return(Ok(accountToEvent));
        }