Esempio n. 1
0
 public ActionResult AlbumEdit(FormCollection fm)
 {
     ((dynamic) base.ViewBag).Title = "编辑专辑";
     Maticsoft.Model.SNS.UserAlbums model = new Maticsoft.Model.SNS.UserAlbums();
     Maticsoft.BLL.SNS.UserAlbums albums2 = new Maticsoft.BLL.SNS.UserAlbums();
     model.AlbumName = fm["AlbumName"];
     model.Description = fm["Description"];
     model.AlbumID = Globals.SafeInt(fm["AlbumID"], 0);
     if (!albums2.UpdateEx(model))
     {
         return base.RedirectToAction("AlbumEdit", new { AlbumId = model.AlbumID });
     }
     int num = Globals.SafeInt(fm["TypeId"], 0);
     Maticsoft.BLL.SNS.UserAlbumsType type = new Maticsoft.BLL.SNS.UserAlbumsType();
     Maticsoft.Model.SNS.UserAlbumsType modelByUserId = type.GetModelByUserId(model.AlbumID, base.currentUser.UserID);
     if (modelByUserId == null)
     {
         modelByUserId = new Maticsoft.Model.SNS.UserAlbumsType {
             TypeID = num,
             AlbumsID = model.AlbumID,
             AlbumsUserID = new int?(base.currentUser.UserID)
         };
         type.AddEx(modelByUserId);
     }
     else
     {
         modelByUserId.TypeID = num;
         type.UpdateType(modelByUserId);
     }
     return base.RedirectToAction("Albums");
 }
Esempio n. 2
0
 public ActionResult AlbumEdit(int AlbumId)
 {
     ((dynamic) base.ViewBag).Title = "编辑专辑";
     Maticsoft.BLL.SNS.UserAlbums albums = new Maticsoft.BLL.SNS.UserAlbums();
     Maticsoft.BLL.SNS.UserAlbumsType type = new Maticsoft.BLL.SNS.UserAlbumsType();
     Maticsoft.BLL.SNS.AlbumType type2 = new Maticsoft.BLL.SNS.AlbumType();
     Maticsoft.Model.SNS.UserAlbums model = albums.GetModel(AlbumId);
     List<Maticsoft.Model.SNS.AlbumType> modelList = type2.GetModelList("Status=1");
     List<SelectListItem> list2 = new List<SelectListItem>();
     SelectListItem item2 = new SelectListItem {
         Value = "0",
         Text = "请选择"
     };
     list2.Add(item2);
     if ((modelList != null) && (modelList.Count > 0))
     {
         foreach (Maticsoft.Model.SNS.AlbumType type3 in modelList)
         {
             SelectListItem item = new SelectListItem {
                 Value = type3.ID.ToString(),
                 Text = type3.TypeName
             };
             list2.Add(item);
         }
         ((dynamic) base.ViewBag).TypeList = list2;
     }
     if (model == null)
     {
         return new EmptyResult();
     }
     Maticsoft.Model.SNS.UserAlbumsType modelByUserId = type.GetModelByUserId(model.AlbumID, base.currentUser.UserID);
     model.TypeId = 0;
     if (modelByUserId != null)
     {
         model.TypeId = modelByUserId.TypeID;
     }
     return base.View(model);
 }