Пример #1
0
        public async Task <IHttpActionResult> PutPlayListMaster(int id, PlayListMaster playListMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != playListMaster.PlayListID)
            {
                return(BadRequest());
            }

            playListMaster.UpdateDate      = DateTime.Now;
            db.Entry(playListMaster).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public async Task <IHttpActionResult> GetPlayListMaster(int id)
        {
            PlayListMaster playListMaster = await db.PlayListMaster.FindAsync(id);

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

            return(Ok(playListMaster));
        }
Пример #3
0
        public async Task <IHttpActionResult> DeletePlayListMaster(int id)
        {
            PlayListMaster playListMaster = await db.PlayListMaster.FindAsync(id);

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

            db.PlayListMaster.Remove(playListMaster);
            await db.SaveChangesAsync();

            return(Ok(playListMaster));
        }
Пример #4
0
        public async Task <IHttpActionResult> PostPlayListMaster(PlayListMaster playListMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            playListMaster.UpdateDate = DateTime.Now;
            playListMaster.InsertDate = DateTime.Now;
            playListMaster.UseFlag    = true;
            db.PlayListMaster.Add(playListMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = playListMaster.PlayListID }, playListMaster));
        }