Exemple #1
0
 public void UpdateEmailAddress([QueryString("Id")] int personId, int id, EmailAddress emailAddress)
 {
     if (ModelState.IsValid)
     {
         try
         {
             using (RepositoryHelpers.GetUnitOfWorkFactory().Create())
             {
                 var          repo        = RepositoryHelpers.GetPeopleRepository();
                 var          person      = repo.FindById(personId, x => x.EmailAddresses);
                 EmailAddress userAddress = person.EmailAddresses.Single(x => x.Id == id);
                 TryUpdateModel(userAddress);
                 EmailAddressesGrid.EditIndex = -1;
                 EmailAddressesGrid.DataBind();
             }
         }
         catch (ModelValidationException mvex)
         {
             foreach (var error in mvex.ValidationErrors)
             {
                 ModelState.AddModelError(error.MemberNames.FirstOrDefault() ?? "", error.ErrorMessage);
             }
         }
     }
 }
Exemple #2
0
 protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
 {
     EmailAddressesGrid.DataBind();
 }