示例#1
0
        // PUT api/Artist/5
        public IHttpActionResult PuttblArtist(int id, tblArtist tblartist)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblartist.Artist_id)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblArtistExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public ActionResult Create([Bind(Include = "author_id,author_name")] authors authors)
        {
            if (ModelState.IsValid)
            {
                db.authors.Add(authors);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(authors));
        }
        public ActionResult Create([Bind(Include = "path_id,path_name")] paths paths)
        {
            if (ModelState.IsValid)
            {
                db.paths.Add(paths);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(paths));
        }
示例#4
0
        public ActionResult Create([Bind(Include = "song_id,format_id,path_id,genre_id,author_id,duration,song_name,song_date,country_id")] songs songs)
        {
            if (ModelState.IsValid)
            {
                db.songs.Add(songs);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.author_id  = new SelectList(db.authors, "author_id", "author_name", songs.author_id);
            ViewBag.country_id = new SelectList(db.countries, "country_id", "country_name", songs.country_id);
            ViewBag.format_id  = new SelectList(db.formats, "format_id", "format_name", songs.format_id);
            ViewBag.genre_id   = new SelectList(db.genres, "genre_id", "genre_name", songs.genre_id);
            ViewBag.path_id    = new SelectList(db.paths, "path_id", "path_name", songs.path_id);
            return(View(songs));
        }