コード例 #1
0
ファイル: NewAlbum.aspx.cs プロジェクト: rnietoy/nietoyosten
        protected void NewAlbumButton_Click(object sender, EventArgs e)
        {
            if (!Roles.IsUserInRole("family"))
            {
                ErrorMessage.Text = "<p class=\"errormsg\">Error: You do not have enough permissions to create an album.</p>";
                ErrorMessage.Visible = true;
                return;
            }

            // Add album to database
            using (var db = new NietoYostenDbDataContext())
            {
                var newAlbum = new Album()
                    {
                        Title = AlbumTitle.Text,
                        FolderName = AlbumFolder.Text
                    };
                db.Albums.InsertOnSubmit(newAlbum);
                db.SubmitChanges();
            }
            // Create folders for album
            //string originalDir = Server.MapPath(string.Format("~/pictures/original/{0}", AlbumFolder.Text));
            Directory.CreateDirectory(Server.MapPath(string.Format("~/pictures/original/{0}", AlbumFolder.Text)));
            Directory.CreateDirectory(Server.MapPath(string.Format("~/pictures/web/{0}", AlbumFolder.Text)));
            Directory.CreateDirectory(Server.MapPath(string.Format("~/pictures/thumb/{0}", AlbumFolder.Text)));

            Response.Redirect("~/Pictures.aspx");
        }
コード例 #2
0
 partial void UpdateAlbum(Album instance);
コード例 #3
0
 partial void DeleteAlbum(Album instance);
コード例 #4
0
 partial void InsertAlbum(Album instance);