コード例 #1
0
        public async Task <IHttpActionResult> Post(Playlist Playlist)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.Playlists.Add(Playlist);
            await db.SaveChangesAsync();

            return(Created(Playlist));
        }
コード例 #2
0
        public async Task <IHttpActionResult> Post(MediaType MediaType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.MediaTypes.Add(MediaType);
            await db.SaveChangesAsync();

            return(Created(MediaType));
        }
コード例 #3
0
        public async Task <IHttpActionResult> Post(Track Track)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.Tracks.Add(Track);
            await db.SaveChangesAsync();

            return(Created(Track));
        }
コード例 #4
0
        public async Task <IHttpActionResult> Post(Customer Customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.Customers.Add(Customer);
            await db.SaveChangesAsync();

            return(Created(Customer));
        }
コード例 #5
0
        public async Task <IHttpActionResult> Post(Album album)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.Albums.Add(album);
            await db.SaveChangesAsync();

            return(Created(album));
        }
コード例 #6
0
        public async Task <IHttpActionResult> Post(InvoiceLine InvoiceLine)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.InvoiceLines.Add(InvoiceLine);
            await db.SaveChangesAsync();

            return(Created(InvoiceLine));
        }