public ActionResult AddFileToTitle(string wikiname, int tid,HttpPostedFileBase file, ViewTitleFile mod) { try { if (CommonTools.isEmpty(wikiname) && tid <= 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } mod.File = new WikiFile(); WikiTitle title = CommonTools.titlemngr.GetTitlebyId(wikiname, tid); mod.Title = title; if ( mod !=null && mod.File !=null && mod.Title !=null && file.ContentLength>0) { WikiFile fmod = mod.File; this.filemngr.AddFile(wikiname, mod.File, file, tid, CommonTools.usrmng.GetUser(this.User.Identity.Name)); } return View(mod); } catch (Exception ex) { CommonTools.ErrorReporting(ex); return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError); } }
public ActionResult AddFileToTitle(string wikiname,int tid) { try { if (CommonTools.isEmpty(wikiname) && tid <= 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } WikiTitle title = CommonTools.titlemngr.GetTitlebyId(wikiname, tid); Wiki wk = CommonTools.wkmngr.GetWiki(wikiname); if (wk==null ) { return HttpNotFound(); } if(title == null) { return HttpNotFound(); } ViewTitleFile mod = new ViewTitleFile(); mod.File = new WikiFile(); mod.Title = title; mod.ToBeAdded = true; return View(mod); } catch (Exception ex) { CommonTools.ErrorReporting(ex); return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError); } }