protected void ButtonClick(object sender, EventArgs e) { var publication = new Framework.Database.Publication { Title = txt_title.Text, Author = txt_author.Text, CategoryId = TextHelper.ToInteger(ddl_category.SelectedValue) ?? 1, Description = txt_description.Text, PublicationDate = TextHelper.ToDateTime(txt_pubdate.Text) ?? DateTime.Now, Active = TextHelper.ToBool(ddl_active.SelectedValue) ?? false }; var objPublication = new PublicationClass(); if (!objPublication.Insert(publication)) { } else { Redirect("~/Admin/Publication/"); } }