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"); }
partial void UpdateAlbum(Album instance);
partial void DeleteAlbum(Album instance);
partial void InsertAlbum(Album instance);