예제 #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 Edit([Bind(Include = "author_id,author_name")] authors authors)
 {
     if (ModelState.IsValid)
     {
         db.Entry(authors).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(authors));
 }
 public ActionResult Edit([Bind(Include = "path_id,path_name")] paths paths)
 {
     if (ModelState.IsValid)
     {
         db.Entry(paths).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(paths));
 }
예제 #4
0
 public ActionResult Edit([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.Entry(songs).State = EntityState.Modified;
         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));
 }