//Update public bool Update(TagViewEditModel model) { var tag = tagRepo.GetById(model.Id); tag.Name = model.Name; tag.Description = model.Description; return(tagRepo.Update(tag)); }
public TagViewEditModel GetEditById(int id) { var tag = tagRepo.GetById(id); var model = new TagViewEditModel { Name = tag.Name, Description = tag.Description }; return(model); }
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)); }