Example #1
0
 public ActionResult Update(int groupId)
 {
     ((dynamic) base.ViewBag).Title = "编辑小组信息";
     UpdateGroup model = new UpdateGroup();
     Maticsoft.Model.SNS.Groups groups = this.bllGroups.GetModel(groupId);
     if (groups.CreatedUserId != base.CurrentUser.UserID)
     {
         return base.RedirectToAction("GroupInfo", new { GroupId = groups.GroupID });
     }
     model.GroupId = groups.GroupID;
     model.GroupLogo = groups.GroupLogo;
     model.GroupName = groups.GroupName;
     model.Tags = groups.Tags;
     model.GroupDescription = groups.GroupDescription;
     List<Maticsoft.Model.SNS.GroupTags> modelList = this.bllGroupTags.GetModelList("Status = 1");
     if (modelList == null)
     {
     }
     model.TagList = (CS$<>9__CachedAnonymousMethodDelegate12 != null) ? "" : string.Join(",", modelList.Select<Maticsoft.Model.SNS.GroupTags, string>(CS$<>9__CachedAnonymousMethodDelegate12));
     return base.View(model);
 }
Example #2
0
 public ActionResult Update(UpdateGroup model)
 {
     ((dynamic) base.ViewBag).Title = "编辑小组信息";
     if (!base.ModelState.IsValid)
     {
         List<Maticsoft.Model.SNS.GroupTags> modelList = this.bllGroupTags.GetModelList("Status = 1");
         if (modelList == null)
         {
         }
         model.TagList = (CS$<>9__CachedAnonymousMethodDelegate18 != null) ? "" : string.Join(",", modelList.Select<Maticsoft.Model.SNS.GroupTags, string>(CS$<>9__CachedAnonymousMethodDelegate18));
         return base.View(model);
     }
     Maticsoft.Model.SNS.Groups groups = this.bllGroups.GetModel(model.GroupId);
     if ((model.GroupName != groups.GroupName) && this.bllGroups.Exists4Ignore(model.GroupName, model.GroupId))
     {
         base.ModelState.AddModelError("Message", "小组名称已经被Ta人抢注, 换个试试");
         List<Maticsoft.Model.SNS.GroupTags> source = this.bllGroupTags.GetModelList("Status = 1");
         if (source == null)
         {
         }
         model.TagList = (CS$<>9__CachedAnonymousMethodDelegate19 != null) ? "" : string.Join(",", source.Select<Maticsoft.Model.SNS.GroupTags, string>(CS$<>9__CachedAnonymousMethodDelegate19));
         return base.View(model);
     }
     groups.GroupName = model.GroupName;
     groups.GroupDescription = model.GroupDescription;
     groups.Tags = string.Join(",", new string[] { model.Tags });
     if (!string.IsNullOrWhiteSpace(model.GroupLogo) && (model.GroupLogo != groups.GroupLogo))
     {
         string path = string.Format(model.GroupLogo, "");
         string str2 = base.HttpContext.Server.MapPath(SNSAreaRegistration.PathUploadImgGroupThumb);
         string str3 = base.HttpContext.Server.MapPath(SNSAreaRegistration.PathUploadImgGroup);
         try
         {
             FileHelper.DeleteFile(Maticsoft.Model.Ms.EnumHelper.AreaType.SNS, groups.GroupLogoThumb);
             FileHelper.DeleteFile(Maticsoft.Model.Ms.EnumHelper.AreaType.SNS, groups.GroupLogo);
             if (Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_ImageStoreWay") == "1")
             {
                 groups.GroupLogoThumb = model.GroupLogo;
                 groups.GroupLogo = model.GroupLogo;
             }
             else
             {
                 if (!Directory.Exists(str2))
                 {
                     Directory.CreateDirectory(str2);
                 }
                 if (!Directory.Exists(str3))
                 {
                     Directory.CreateDirectory(str3);
                 }
                 List<Maticsoft.Model.Ms.ThumbnailSize> thumSizeList = Maticsoft.BLL.Ms.ThumbnailSize.GetThumSizeList(Maticsoft.Model.Ms.EnumHelper.AreaType.SNS, "");
                 if ((thumSizeList != null) && (thumSizeList.Count > 0))
                 {
                     string str4 = "";
                     foreach (Maticsoft.Model.Ms.ThumbnailSize size in thumSizeList)
                     {
                         str4 = string.Format(model.GroupLogo, size.ThumName);
                         if (File.Exists(base.Server.MapPath(str4)))
                         {
                             FileInfo info = new FileInfo(base.HttpContext.Server.MapPath(str4));
                             info.MoveTo(str2 + info.Name);
                         }
                     }
                 }
                 FileInfo info2 = new FileInfo(base.HttpContext.Server.MapPath(path));
                 info2.MoveTo(str3 + info2.Name);
                 groups.GroupLogoThumb = SNSAreaRegistration.PathUploadImgGroupThumb + "{0}" + info2.Name;
                 groups.GroupLogo = SNSAreaRegistration.PathUploadImgGroup + info2.Name;
             }
         }
         catch (Exception)
         {
             base.ModelState.AddModelError("Message", "您上传的文件保存失败, 请重新上传!");
             List<Maticsoft.Model.SNS.GroupTags> list4 = this.bllGroupTags.GetModelList("Status = 1");
             if (list4 == null)
             {
             }
             model.TagList = (CS$<>9__CachedAnonymousMethodDelegate1a != null) ? "" : string.Join(",", list4.Select<Maticsoft.Model.SNS.GroupTags, string>(CS$<>9__CachedAnonymousMethodDelegate1a));
             return base.View(model);
         }
     }
     if (this.bllGroups.Update(groups))
     {
         return base.RedirectToAction("GroupInfo", new { GroupId = groups.GroupID });
     }
     return base.View(model);
 }