Exemplo n.º 1
0
 public void Save()
 {
     try
     {
         if (!IsNew & IsDeleted)
         {
             /* [Delete] an existing object marked for deletion */
             //dc.ArticleDelete(Id);
         }
         else
         {
             /* Exception will cause the transaction to rollback */
             if (IsNew)
             {
                 /* [Insert] a new and valid object to be saved */
                 this.Salt     = Guid.NewGuid().ToString();
                 this.Password = this.ConfirmPassword = UserPrincipal.EncodePassword(this.Password, this.Salt);
                 _accountRepository.InsertUser(BuildInterface());
             }
             else if (!IsNew & IsDirty)
             {
                 /* [Update] a existing, but changed object to be saved */
                 _accountRepository.UpdateUser(BuildInterface());
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }