コード例 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.Book u = new Model.Book
            {
                Book_Title   = this.txtTitle.Text,
                Book_Content = this.txtContent.Text,
                Book_Image   = upFileName(this.FileUpload1, "../../upload/Book/"),
                Book_Price   = float.Parse(this.txtPrice.Text),
                Book_publish = this.txtpublish.Text,
                Book_Author  = this.txtAuthor.Text,
                Book_Intro   = this.txtIntro.Text,
                Book_Catalog = this.txtCatalog.Text,
                Book_Read    = this.txtRead.Text,
            };
            var       res = BookSvc.Add(u);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "新增用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Book_List.aspx");
        }
コード例 #2
0
        public void AddNewBook()
        {
            string x = BookServices.Add(Title, Author, ReleaseDate, ISBN, Count, SelectedBookGenre);

            if (x == null)
            {
                TryClose();
            }
            else
            {
                Error = x;
            }
        }