Ext.Net.MVC.Examples.Areas.GridPanel_Update.Models.AutoSave.TestPerson.DeletePerson C# (CSharp) Method

DeletePerson() public static method

public static DeletePerson ( int id ) : void
id int
return void
        public static void DeletePerson(int id)
        {
            lock (lockObj)
            {
                var persons = TestPerson.Storage;
                TestPerson person = null;

                foreach (TestPerson p in persons)
                {
                    if (p.Id == id)
                    {
                        person = p;
                        break;
                    }
                }

                if (person == null)
                {
                    throw new Exception("TestPerson not found");
                }

                persons.Remove(person);

                TestPerson.Storage = persons;
            }
        }