public ActionResult Edit(int? id) {
     tId = id ?? 1;
     using (club = new ClubEntities())
     {
         topicCategory = club.TopicCategories.Where(t => t.Id == tId).FirstOrDefault();
     }
     if (topicCategory == null)
         return RedirectToAction("notfound","error");
     return View("~/areas/bwum/views/discuss/create.cshtml", topicCategory);
 }
 public ActionResult Create(string name, string description, string pic,string icon, string variable)
 {
     topicCategory = new TopicCategory() { Name = name, Description = description, Cover = pic, Icon=icon,Variable = variable, VarDate = DateTime.Now,Type=1 };
     if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(variable))
     {
         hitStr = "分类的名称、变量缺一不可";
     }
     else {
         using (club = new ClubEntities()) {
             club.TopicCategories.Add(topicCategory);
             if (club.SaveChanges() >= 0)
             {
                 status = Status.success;
                 hitStr = "分类名称创建成功!";
             }
             else {
                 hitStr = "系统异常,请稍后重试!";
             }
         }
     }
     ViewBag.StatusStr = Common.HtmlCommon.GetHitStr(hitStr, status);
     return View("~/areas/bwum/views/discuss/create.cshtml",topicCategory);
 }
 public ActionResult Create(string name, string variable, string description)
 {
     topicCategory = new TopicCategory() {Name=name,Variable=variable,VarDate=DateTime.Now,Description=description,Type=0 };
     if (string.IsNullOrEmpty(topicCategory.Name) || string.IsNullOrEmpty(topicCategory.Variable))
     {
         hitStr = "论坛模块添加失败,论坛名称或模块变量不能为空!";
     }
     else {
         using (club = new ClubEntities()) {
             club.TopicCategories.Add(topicCategory);
             if (club.SaveChanges() > 0)
             {
                 status = Status.success;
                 hitStr = "论坛模块添加成功!";
             }
             else {
                 hitStr = "系统异常,论坛模块添加失败!";
             }
         }
     }
     ViewBag.StatusStr = HtmlCommon.GetHitStr(hitStr,status);
     return View("~/areas/bwum/views/forum/create.cshtml", topicCategory);
 }
 public ActionResult Edit(int id,string name,string description,string pic,string icon,string variable)
 {
     using(club=new ClubEntities()){
         topicCategory = club.TopicCategories.Where(t => t.Id == id).FirstOrDefault();
         if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(variable))
         {
             hitStr = "分类的名称、变量缺一不可";
         }
         else {
             if (topicCategory == null)
             {
                 return RedirectToAction("notfound", "error");
             }
             else
             {
                 topicCategory.Name = name;
                 topicCategory.Description = description;
                 topicCategory.Cover = pic;
                 topicCategory.Variable = variable;
                 topicCategory.Icon = icon;
                 if (club.SaveChanges() >= 0)
                 {
                     status = Status.success;
                     hitStr = "分类更新成功!";
                 }
                 else
                 {
                     hitStr = "系统异常,请稍后重试!";
                 }
             }
         }                
     }
     ViewBag.StatusStr = Common.HtmlCommon.GetHitStr(hitStr, status);
     return View("~/areas/bwum/views/discuss/create.cshtml", topicCategory);
 }
 public ActionResult Create() {
     topicCategory = new TopicCategory();
     return View("~/areas/bwum/views/discuss/create.cshtml", topicCategory);
 }
 public ActionResult Edit(int? id, string name, string variable, string description)
 {
     tId=id??0;
     using (club = new ClubEntities()) {
         topicCategory = club.TopicCategories.Where(t => t.Id == tId).FirstOrDefault();
         if (topicCategory == null)
             return RedirectToAction("notfound", "error");
         topicCategory.Name = name;
         topicCategory.Variable = variable;
         topicCategory.Description = description;
         if (club.SaveChanges() >= 0)
         {
             status = Status.success;
             hitStr = "模块更新成功!";
         }
         else {
             hitStr = "系统异常。论坛模块更新失败!";
         }
     }
     ViewBag.StatusStr = HtmlCommon.GetHitStr(hitStr, status);
     return View("~/areas/bwum/views/forum/create.cshtml",topicCategory);
 }