//添加品牌 protected void BtnSvae_Click(object sender, EventArgs e) { try { BrandBLL bll = new BrandBLL(); BrandModel model = new BrandModel(); model.Title = PageValidate.HtmlEncode(txtTitle.Value.Trim()); model.ImgPath = PageValidate.HtmlEncode(txtImgPath.Value.Trim()); model.Url = PageValidate.HtmlEncode(txtUrl.Value.Trim()); model.ShowPosition = ShowPosition.SelectedValue; model.Sort = (txtSort.Value.Trim() == "") ? 0 : Convert.ToInt32(txtSort.Value.Trim()); model.Remarks = txtRemarks.Value.Trim(); if (bll.AddBrand(model)) { Tz888.Common.MessageBox.ShowAndRedirect(this.Page, "添加成功!", "BrandManage.aspx", false); } else { Tz888.Common.MessageBox.Show(this.Page, "添加失败!"); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public IActionResult Create([Bind] Brand brand) { if (ModelState.IsValid) { _dB.AddBrand(brand); return(RedirectToAction("Index")); } return(View(brand)); }
protected void Button1_Click(object sender, EventArgs e) { TBrand tbrand = InitBrand(); BrandBLL brandbll = new BrandBLL(); brandbll.AddBrand(tbrand); int lastid = brandbll.GetLastID(); CommonLibrary.RunJs.PageReplace("Brand_UpdateManage.aspx?LastID=" + lastid); }
//[EnableCors("AllowAll")] public IActionResult Create([Bind] Brand brand) { try { _dB.AddBrand(brand); } catch (Exception e) { throw new Exception(e.Message); } return(Ok(brand)); }