Beispiel #1
0
        public async Task <IHttpActionResult> PostMultiSectionTimes(MultiSectionTimes multiSectionTimes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MultiSectionTimes.Add(multiSectionTimes);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (MultiSectionTimesExists(multiSectionTimes.SecId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = multiSectionTimes.SecId }, multiSectionTimes));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> PutMultiSectionTimes(int id, MultiSectionTimes multiSectionTimes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != multiSectionTimes.SecId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> GetMultiSectionTimes(int id)
        {
            MultiSectionTimes multiSectionTimes = await db.MultiSectionTimes.FindAsync(id);

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

            return(Ok(multiSectionTimes));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> DeleteMultiSectionTimes(int id)
        {
            MultiSectionTimes multiSectionTimes = await db.MultiSectionTimes.FindAsync(id);

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

            db.MultiSectionTimes.Remove(multiSectionTimes);
            await db.SaveChangesAsync();

            return(Ok(multiSectionTimes));
        }