To refresh the interface after the first type of frame is successful
[HttpPost] PublicActionResult ADD (Maticsoft.Model.Project.ProjectMoneyPlan model) {model. Money=NewMaticsoft.Model.Struct.DRMB (Model. Money). ToDouble (). ToString (); Maticsoft.BLL.User.LoginUser Login=NewMaticsoft.BLL.User.LoginUser (); Model. Creater=Login. Email; Try { if(BLL. Exist ("Pro_moneyplan","where procode= '"+ model. Procode +"'","Procode") && BLL. Exist ("Pro_moneyplan","where year="+ model. Year," Year") && BLL. Exist ("Pro_moneyplan","where Month="+ model. Month,"Month")) { ///Bullet Box stringScript = String.Format ("<script>alert (' Data already exists! '); location.href= ' {0} ' </script>", Url.action ("ADD")); returnContent (script,"text/html"); } Else{BLL. ADD (model); returnView ("List"); } } Catch(Exception ex) {return NewMaticsoft.BLL.Error (). Doerror (ex); } }
The second type of box does not refresh the interface after success:
[HttpPost] PublicActionResult ADD (Maticsoft.Model.Project.ProjectMoneyPlan model) {model. Money=NewMaticsoft.Model.Struct.DRMB (Model. Money). ToDouble (). ToString (); Maticsoft.BLL.User.LoginUser Login=NewMaticsoft.BLL.User.LoginUser (); Model. Creater=Login. Email; Try { if(BLL. Exist ("Pro_moneyplan","where procode= '"+ model. Procode +"'","Procode") && BLL. Exist ("Pro_moneyplan","where year="+ model. Year," Year") && BLL. Exist ("Pro_moneyplan","where Month="+ model. Month,"Month") ) {viewdata["Proname"] = Selecopption.getopption ("Pro_b","","Code,name");//Get project nameviewdata[" Year"] =GetYear (); viewdata["Month"] =GetMonth (); ///Bullet BoxViewbag.isexist =false; returnView (); } Else{BLL. ADD (model); returnView ("List"); } } Catch(Exception ex) {return NewMaticsoft.BLL.Error (). Doerror (ex); } }
Front desk:
@if (Viewbag.isexist = = False) { <type= "Text/javascript"> alert ( " the data you want to add already exists! ") </script>
MVC Controller Bullet Box