Exemplo n.º 1
0
        public ActionResult UploadSketch(HttpPostedFileBase WAVUpload,
                                         HttpPostedFileBase MP3Upload, string ArtistNote, string AuctionId, string name)
        {
            if (ModelState.IsValid)
            {
                string ArtistId = User.Identity.GetUserId();
                var    auction  = this._actionSrv.GetByID(AuctionId).Entity;

                if (auction != null)
                {
                    // Create music obg
                    var sketch = new Sketch()
                    {
                        Name       = name,
                        ArtistID   = ArtistId,
                        Comment    = ArtistNote,
                        CreateDate = DateTime.Now
                    };

                    // Convert music to File
                    Model.File mp3File = FileHelper.
                                         ConvertPostedFileToFile(MP3Upload, 0, ArtistId, null);
                    Model.File wavFile = FileHelper.
                                         ConvertPostedFileToFile(WAVUpload, 0, ArtistId, null);

                    // Add music to db and to file system
                    var res = _musicSrv.AddSketchToAuction(auction, sketch, wavFile, mp3File);
                }
            }
            return(Redirect("~/Artist/OriginalMusic"));
        }