Пример #1
0
        public ActionResult CreateLyrics()
        {
            var VM = new ViewModel.LyricsViewModel();

            VM.lyrics            = db.lyricsTable;
            VM.lyricsCategory    = db.LyricsCategoryTable;
            VM.lyricsSubCategory = db.LyricsSubCategoryTable;
            return(View(VM));
        }
Пример #2
0
        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));
        }