public ActionResult CreateLyrics() { var VM = new ViewModel.LyricsViewModel(); VM.lyrics = db.lyricsTable; VM.lyricsCategory = db.LyricsCategoryTable; VM.lyricsSubCategory = db.LyricsSubCategoryTable; return(View(VM)); }
public ActionResult CreateLyrics(Models.lyricsTable aLyric) { string fileName = ""; if (Request.Files["files"].FileName != "" && Request.Files["files"].ContentLength > 0) { var photo = Request.Files["files"]; fileName = photo.FileName.clearFileNameWithUniqueIdentifier(); photo.SaveAs(Server.MapPath("~/Images/LyricsPhotos/") + fileName); aLyric.image = fileName; } db.lyricsTable.Add(aLyric); db.SaveChanges(); ModelState.Clear(); var VM = new ViewModel.LyricsViewModel(); VM.lyrics = db.lyricsTable; VM.lyricsCategory = db.LyricsCategoryTable; VM.lyricsSubCategory = db.LyricsSubCategoryTable; return(View(VM)); }