Example #1
0
        public async Task <IHttpActionResult> PutEvent_Going(int id, Event_Going event_Going)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != event_Going.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public async Task <IHttpActionResult> GetEvent_Going(int id)
        {
            Event_Going event_Going = await db.Event_Going.FindAsync(id);

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

            return(Ok(event_Going));
        }
Example #3
0
        public async Task <IHttpActionResult> PostEvent_Going(Event_Going event_Going)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Event_Going.Add(event_Going);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = event_Going.Id }, event_Going));
        }
Example #4
0
        public async Task <IHttpActionResult> DeleteEvent_Going(int id)
        {
            Event_Going event_Going = await db.Event_Going.FindAsync(id);

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

            db.Event_Going.Remove(event_Going);
            await db.SaveChangesAsync();

            return(Ok(event_Going));
        }