Пример #1
0
        public virtual ActionResult Edit(ThingEditModel model)
        {
            try
            {
                var thing = this._thingService.Store(model.Id, model.Name, model.SKU, model.Description, model.SelectedTags.ToList(), this.User.Identity.Name);

                return RedirectToAction(MVC.Thing.Details(thing.Id));
            }
            catch
            {
                return View(model);
            }
        }
Пример #2
0
        //
        // GET: /Thing/Edit/5
        public virtual ActionResult Edit(string id)
        {
            var thing = this._thingService.Get(id);
            if (thing.UserId != this.User.Identity.Name)
            {
                throw new SecurityException("No access to specified thing.");
            }

            var model = new ThingEditModel()
                {
                    Id = thing.Id,
                    Name = thing.Name,
                    SKU = thing.SKU,
                    Description = thing.Description,
                    SelectedTags = thing.Tags.Select(x => x.Name).ToList()
                };

            return View(MVC.Thing.Views.Edit, model);
        }