Пример #1
0
        public ActionResult Upload(UploadSongBindingModel model)
        {
            if (model.AudioFile.ContentType.Contains("audio") &&
                model.AudioFile.ContentLength > 0)
            {
                var    audioPath     = Server.MapPath("~/uploads/audio/");
                var    imagePath     = Server.MapPath("~/uploads/image/");
                string audioFileName = service.UploadAudioFile(model.AudioFile, audioPath);
                string coverFileName = service.UploadCoverFile(model.ImageFile, imagePath);

                service.AddSong(model, audioFileName, coverFileName);

                return(RedirectToAction("Index"));
            }

            ViewBag.Genres = service.GetAvailableGenres();
            return(View(model));
        }