public ActionResult AddTitleToCategory(string wikiname, int tid) { try { if (CommonTools.isEmpty(wikiname) && tid <= 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } WikiTitle title = this.tmngr.GetTitlebyId(wikiname, tid); if (title == null) { return HttpNotFound(); } ViewTitleCategories mod = new ViewTitleCategories(); mod.Title = title; mod.Categories = this.catmngr.GetCategoryListByWiki(wikiname); return View(mod); } catch (Exception ex) { CommonTools.ErrorReporting(ex); return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError); } }
public ActionResult AddTitleToCategory(string wikiname, ViewTitleCategories model, int tid) { try { int catid = 0; string catname; if (CommonTools.isEmpty(wikiname) && tid <= 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } WikiTitle title = this.tmngr.GetTitlebyId(wikiname, tid); if (title == null) { return HttpNotFound(); } if (tid > 0 && model != null && model.CategoryToAddOrRemove != null) //&& CommonTools.isEmpty( con["UserToAdd"])==false) { catname = model.CategoryToAddOrRemove.Title; WikiCategory cat = this.catmngr.GetCategoryByTitle(catname, wikiname); if (cat==null) { return HttpNotFound(); } catid = cat.Id; if (catid > 0) { this.catmngr.AddTitleToCategory(wikiname, catid, title); } } RouteValueDictionary vals = new RouteValueDictionary(); vals.Add("wikiname", wikiname); vals.Add("cid", catid); return RedirectToAction("Index", "WikiContent", vals); } catch (Exception ex) { CommonTools.ErrorReporting(ex); return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError); } }