Пример #1
0
        public async Task <IActionResult> PutSong(int id, Song song)
        {
            if (id != song.SongID)
            {
                return(BadRequest());
            }

            _context.Entry(song).State = EntityState.Modified;

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

            return(NoContent());
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "SongId,Title,Album,Singer,Category,YearOfRelease, Price, Description")] Song song)
 {
     if (ModelState.IsValid)
     {
         db.Entry(song).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(song));
 }