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

            if (id != eventActivitySpeaker.SpeakerID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public async Task <IHttpActionResult> GetEventActivitySpeaker(int id)
        {
            EventActivitySpeaker eventActivitySpeaker = await db.EventActivitySpeakers.FindAsync(id);

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

            return(Ok(eventActivitySpeaker));
        }
Example #3
0
        public async Task <IHttpActionResult> PostEventActivitySpeaker(EventActivitySpeaker eventActivitySpeaker)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EventActivitySpeakers.Add(eventActivitySpeaker);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = eventActivitySpeaker.SpeakerID }, eventActivitySpeaker));
        }
Example #4
0
        public async Task <IHttpActionResult> DeleteEventActivitySpeaker(int id)
        {
            EventActivitySpeaker eventActivitySpeaker = await db.EventActivitySpeakers.FindAsync(id);

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

            db.EventActivitySpeakers.Remove(eventActivitySpeaker);
            await db.SaveChangesAsync();

            return(Ok(eventActivitySpeaker));
        }