Pushing multiple entries and saving them in database through AngularJS

angularjs asp.net-mvc entity-framework-6

Accepted Answer

ZZZ_tmp
1
4/20/2016 9:38:42 PM

Popular Answer

This solution worked because the issue was with my C# controller's server side code:

[HttpPost]
        public void AddPerson(List<TestModel> test)
        {
            using (TestContext db = new TestContext())
            {
                foreach(var t in test) 
                {
                    if (t != null)
                    {
                        db.TestModels.Add(t);
                        Console.WriteLine("Success");
                    }
                }
                db.SaveChanges(); //save context at the end, when no error occurs
            }
        }


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow