Beispiel #1
0
 partial void DeletePost(Post instance);
Beispiel #2
0
 partial void InsertPost(Post instance);
Beispiel #3
0
 partial void UpdatePost(Post instance);
Beispiel #4
0
        protected void btnSavePost_Click(object sender, EventArgs e)
        {
            Post p;
            if (Session["guidPost"] != null) guidPost = (Guid)Session["guidPost"];

            // check for update or new record
            if (guidPost != Guid.Empty)
            {
                // existing post
                var query = from q in db.Posts
                            where q.post_id == guidPost
                            select q;
                p = query.First();
            }
            else
            {
                // this is a new post
                p = new Post();
                p.post_id = Guid.NewGuid();
            }

            p.posted = Convert.ToDateTime(txtPostDate.Text);
            p.submitter = Page.User.Identity.Name;
            p.enabled = cbxPostEnabled.Checked;
            p.title = txtTitle.Text;
            p.post_content = fckWindow.Value;

            if (guidPost == Guid.Empty)
            {
                db.Posts.InsertOnSubmit(p);
            }

            db.SubmitChanges();

            mvNewPost.ActiveViewIndex = 1;
        }