public ActionResult Add(AddTagModel model) { if (!ModelState.IsValid) { return View("_PartialAddTag", model); } var _tags = Book.Get(model.Id).AddTags(model.Tag.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).Where(w => !String.IsNullOrEmpty(w)).ToArray()); var tags = Mapper.Map<TagModel[]>(_tags); return new JsonResult { Data = new { tags = tags, bookid = model.Id }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public ActionResult Add(int? id) { var view = new AddTagModel { Id = id ?? 0, Tag = "" }; return View("_PartialAddTag", view); }