Exemple #1
0
        public ActionResult Edit(TagEdit model)
        {
            if (!ModelState.IsValid)
            {
                var contract = Service.GetTagForEdit(model.Name);
                model.CopyNonEditableProperties(contract);
                return(View(model));
            }

            Service.UpdateTag(model.ToContract());

            return(RedirectToAction("Details", new { id = model.Name }));
        }
Exemple #2
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 = queries.GetTagForEdit(model.Name);
                model.CopyNonEditableProperties(contract);
                return(View(model));
            }

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

            return(RedirectToAction("Details", new { id = model.Name }));
        }