protected void Button1_Click(object sender, EventArgs e) { var model = new ServiceModel(); string s = Request["Type"]; model.Subject = TextBoxSub.Text; model.RightSub = TextBox_RSub.Text; model.discription = TextBox1.Text; model.SEO_discription = TextBox_SEO_D.Text; model.SEO_Keyword = TextBox_SEO_K.Text; model.VideoLink = TextBox_VideoLink.Text; model.VideoSub1 = TextBox_VideoSub1.Text; model.VideoSub2 = TextBox_VideoSub2.Text; model.Background_Id = Convert.ToInt32(JsonConvert.DeserializeObject <List <UploaderModel> >(HiddenField_BackGround.Value)[0].idOfImg); model.VideoBackground_Id = Convert.ToInt32(JsonConvert.DeserializeObject <List <UploaderModel> >(HiddenField_VideoBack.Value)[0].idOfImg); model.LeftPic_Id = Convert.ToInt32(JsonConvert.DeserializeObject <List <UploaderModel> >(HiddenField_LeftPic.Value)[0].idOfImg); model.RightPic_Id = Convert.ToInt32(JsonConvert.DeserializeObject <List <UploaderModel> >(HiddenField_RightPic.Value)[0].idOfImg); if (CheckBox_Show.Checked) { model.Show = 1; } else { model.Show = 0; } if (s == "Edit") { int Id = Convert.ToInt32(Request["Id"]); model.S_Id = Id; Logic.UpdateService(model); string myScriptValue = " swal(' با موفقیت ثبت شد!', status, 'success').then(function (e) {console.log('1'); "; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myScriptName", myScriptValue, true); Response.Redirect("/Admin_Services.aspx"); } else { model.S_Id = 0; Logic.AddService(model); string myScriptValue = " swal(' با موفقیت ثبت شد!', status, 'success').then(function (e) {console.log('1'); "; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myScriptName", myScriptValue, true); Response.Redirect("/Admin_Services.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { var model = new ServiceModel(); string s = Request["Type"]; if (s == "Edit") { int Id = Convert.ToInt32(Request["Id"]); model.S_Id = Id; } else { model.S_Id = 0; } model.Subject = TextBoxSub.Text; model.RightSub = TextBox_RSub.Text; model.discription = TextBox1.Text; model.SEO_discription = TextBox_SEO_D.Text; model.SEO_Keyword = TextBox_SEO_K.Text; model.VideoLink = TextBox_VideoLink.Text; model.VideoSub1 = TextBox_VideoSub1.Text; model.VideoSub2 = TextBox_VideoSub2.Text; model.Background_Id = Convert.ToInt32(HiddenField_BackGround.Value); model.VideoBackground_Id = Convert.ToInt32(HiddenField_VideoBack.Value); model.LeftPic_Id = Convert.ToInt32(HiddenField_LeftPic.Value); model.RightPic_Id = Convert.ToInt32(HiddenField_RightPic.Value); if (CheckBox_Show.Checked) { model.Show = 1; } else { model.Show = 0; } Logic.AddService(model); }