Exemple #1
0
 public ActionResult Edit(string id)
 {
     var model = new TagEdit(Service.GetTagForEdit(id));
     return View(model);
 }
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 = Service.GetTagForEdit(model.Name);
                model.CopyNonEditableProperties(contract);
                return View(model);
            }

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

            return RedirectToAction("Details", new { id = model.Name });
        }
Exemple #3
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 });
        }