private void Save() { this.brandModel.BrandName = this.tbName.Text; if (this.isReplaceImg) { this.brandModel.BrandImg = this.brandModel.BrandId + "1" + Path.GetExtension(this.tbImage.Text); } this.brandModel.BrandTypeId = 0; this.brandModel.BrandState = 0; int order = 0; int.TryParse(this.tbOrder.Text, out order); this.brandModel.OderSart = order; if (this.maintainType == MaintainType.New) { var addResult = WebRequestUtil.AddBrand(JsonUtil.Serialize(this.brandModel)); if (addResult == null || addResult.StatusCode != System.Net.HttpStatusCode.OK) { MessageBox.Show("新建品牌失败!"); } } else { var updateResult = WebRequestUtil.UpdateBrand(this.brandModel.BrandId, JsonUtil.Serialize(this.brandModel)); if (updateResult == null || updateResult.StatusCode != System.Net.HttpStatusCode.OK) { MessageBox.Show("更新品牌失败!"); } } //replace image if (this.isReplaceImg) { this.ReplaceImage(); } }