コード例 #1
0
        public ActionResult Me(Contact contact)
        {
            directory.UpdateContact(contact);

              return View();
        }
コード例 #2
0
ファイル: ContactDirectory.cs プロジェクト: kzhen/NHS-HackDay
        public void UpdateContact(Contact contact)
        {
            var found = contacts.SingleOrDefault(m => m.Id == contact.Id);

              if (found != null)
              {
            //contacts.Remove(found);
            //contacts.Add(contact);
            int idx = contacts.IndexOf(found);
            //found = contact;
            contacts[idx] = contact;

            teams = new List<Team>();

            var t1 = new Team()
            {
              Name = "X Ray",
              Id = "8888",
              TeamMembers = new List<Contact>()
            };

            t1.TeamMembers.Add(contacts.Single(m => m.Id == "1111"));
            t1.TeamMembers.Add(contacts.Single(m => m.Id == "2222"));
            t1.TeamMembers.Add(contacts.Single(m => m.Id == "3333"));

            teams.Add(t1);
              }
              else
              {
            contacts.Add(contact);
              }
        }