public ActionResult AjaxAddAlbum(FormCollection Fm) { if (base.currentUser == null) { return base.Content("NoLogin"); } if (base.CurrentUser.UserType == "AA") { return base.Content("AA"); } string str = Fm["AlbumName"]; int typeId = Globals.SafeInt(Fm["Type"], 0); Maticsoft.BLL.SNS.UserAlbums albums = new Maticsoft.BLL.SNS.UserAlbums(); Maticsoft.Model.SNS.UserAlbums model = new Maticsoft.Model.SNS.UserAlbums { AlbumName = str, CreatedDate = DateTime.Now, CreatedNickName = base.currentUser.NickName, CreatedUserID = base.currentUser.UserID }; if ((model.AlbumID = albums.AddEx(model, typeId)) > 0) { Maticsoft.BLL.SNS.UserAlbumsType type = new Maticsoft.BLL.SNS.UserAlbumsType(); Maticsoft.Model.SNS.UserAlbumsType type2 = new Maticsoft.Model.SNS.UserAlbumsType { AlbumsID = model.AlbumID, AlbumsUserID = new int?(model.CreatedUserID), TypeID = typeId }; if (type.Add(type2)) { return base.Content(model.AlbumID.ToString()); } } return base.Content("No"); }
public ActionResult Create(FormCollection collection) { ((dynamic) base.ViewBag).Title = "创建新专辑"; try { if (!base.HttpContext.User.Identity.IsAuthenticated) { return base.RedirectToAction("Login", "Account"); } if (base.currentUser.UserType == "AA") { return base.View(); } Maticsoft.Model.SNS.UserAlbums model = new Maticsoft.Model.SNS.UserAlbums { AlbumName = collection["AlbumName"], Description = collection["Description"], CreatedNickName = base.CurrentUser.NickName, CreatedUserID = base.CurrentUser.UserID }; int typeId = Globals.SafeInt(collection["TypeRadio"], 0); int num2 = new Maticsoft.BLL.SNS.UserAlbums().AddEx(model, typeId); if (num2 > 0) { Maticsoft.BLL.SNS.UserAlbumsType type = new Maticsoft.BLL.SNS.UserAlbumsType(); Maticsoft.Model.SNS.UserAlbumsType type2 = new Maticsoft.Model.SNS.UserAlbumsType { AlbumsID = num2, AlbumsUserID = new int?(model.CreatedUserID), TypeID = typeId }; type.Add(type2); } return base.RedirectToAction("Albums", "Profile"); } catch { return base.View(); } }