示例#1
0
        //Update
        public bool Update(TagViewEditModel model)
        {
            var tag = tagRepo.GetById(model.Id);

            tag.Name        = model.Name;
            tag.Description = model.Description;

            return(tagRepo.Update(tag));
        }
示例#2
0
        public TagViewEditModel GetEditById(int id)
        {
            var tag   = tagRepo.GetById(id);
            var model = new TagViewEditModel
            {
                Name        = tag.Name,
                Description = tag.Description
            };

            return(model);
        }
示例#3
0
        public ActionResult Edit(int id, TagViewEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (TagService.Update(model))
            {
                TempData["SaveResult"] = "Your tag was updated.";
                return(RedirectToAction("Index"));
            }
            ;
            ModelState.AddModelError("", "Tag could not be updated.");
            return(View(model));
        }