Example #1
0
        public ActionResult Edit(TagEdit model)
        {
            var coverPicUpload = Request.Files["thumbPicUpload"];
            UploadedFileContract uploadedPicture = null;
            if (coverPicUpload != null && coverPicUpload.ContentLength > 0) {

                CheckUploadedPicture(coverPicUpload, "thumbPicUpload");
                uploadedPicture = new UploadedFileContract { Mime = coverPicUpload.ContentType, Stream = coverPicUpload.InputStream };

            }

            if (!ModelState.IsValid) {
                var contract = Service.GetTagForEdit(model.Name);
                model.CopyNonEditableProperties(contract);
                return View(model);
            }

            queries.Update(model.ToContract(), uploadedPicture);

            return RedirectToAction("Details", new { id = model.Name });
        }
        public ActionResult Edit(SongListEdit model)
        {
            var coverPicUpload = Request.Files["thumbPicUpload"];
            UploadedFileContract uploadedPicture = null;
            if (coverPicUpload != null && coverPicUpload.ContentLength > 0) {

                CheckUploadedPicture(coverPicUpload, "thumbPicUpload");
                uploadedPicture = new UploadedFileContract {Mime = coverPicUpload.ContentType, Stream = coverPicUpload.InputStream};

            }

            if (!ModelState.IsValid) {
                return View(model);
            }

            var listId = queries.UpdateSongList(model.ToContract(), uploadedPicture);

            return RedirectToAction("Details", new { id = listId });
        }