[HttpPost] // при получении запроса Post public string Buy(Purches purches) { // добавляем информацию о покупке в базу данных db.Purcheses.Add(purches); // сохраняем в бд все изменения db.SaveChanges(); return("Спасибо, " + purches.Name + ", за покупку!"); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); xsql = new System.Data.SqlClient.SqlConnection(); //Data Source = (localdb)\v11.0; AttachDbFilename = C:\Users\Amjad\source\repos\BALOOTA\BALOOTA\Database1.mdf; Integrated Security = True xsql.ConnectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True"; //Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Amjad\source\repos\BALOOTA\BALOOTA\Database1.mdf;Integrated Security=True;User Instance=True//@" Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\oweis\Desktop\RRS\RRS\Database1.mdf;Integrated Security=True;User Instance=True"; xsrc = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True"; //Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Amjad\source\repos\BALOOTA\BALOOTA\Database1.mdf;Integrated Security=True;User Instance=True//@" Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\oweis\Desktop\RRS\RRS\Database1.mdf;Integrated Security=True;User Instance=True"; myform1 = new Form1(); myform2 = new Form2(); myaddemp = new Addemp(); myalert = new Alert(); myviewout = new Viewout(); myviewpur = new Viewpur(); myviewsale = new Viewsale(); mysales = new Sales(); mysignin = new Signin(); myref = new Ref(); mypassword = new Password(); myprofit = new Profit(); mypurchase = new Purches(); myeditemp = new Editemp(); myeditout = new Editout(); myeditstore = new Editstore(); myinventory = new Inventory(); myinvoucein = new Invoucein(); mymain = new Main(); myout = new Out(); myrp = new RP(); mynote = new Notes(); myforget = new Forget(); mycoDebt = new CoDebt(); mycusDebt = new CusDebt(); myempDebt = new EmpDebt(); mystoreDebt = new StoreDebt(); myN = new N(); mySalary = new Salary(); mystoreP = new StoreP(); myempP = new EmpP(); myF = new F(); Application.Run(new Form1()); }