private void Button_Click(object sender, RoutedEventArgs e)
        {
            Models.ActionResultModelBinding result = null;
            try
            {
                if (_model != null)
                {
                    _model.Code  = txtCode.Text;
                    _model.Title = txtTitle.Text;


                    var errors = _model.Validate(null);
                    if (errors.Count() > 0)
                    {
                        foreach (var item in errors)
                        {
                            MessageBox.Show(item.ErrorMessage);
                        }
                    }
                    else
                    {
                        using (var controller = new Controllers.PeopleGroupController())
                        {
                            result = controller.UpdatePeopleGroup(_model);
                        }
                    }
                }
            }
            catch (Exception c)
            {
                MessageBox.Show(c.Message);
                return;
            }
            finally
            {
                if (result != null)
                {
                    MessageBox.Show(result.Message);

                    Close();
                }
            }
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Models.ActionResultModelBinding result = null;
     try
     {
         Models.PeopleGroup newPeopleGroupObject = new Models.PeopleGroup
         {
             Code  = txtCode.Text,
             Title = txtTitle.Text,
         };
         var errors = newPeopleGroupObject.Validate(null);
         if (errors.Count() > 0)
         {
             foreach (var item in errors)
             {
                 MessageBox.Show(item.ErrorMessage);
             }
         }
         else
         {
             using (var controller = new Controllers.PeopleGroupController())
             {
                 result = controller.InsertPeopleGroup(newPeopleGroupObject);
             }
         }
     }
     catch (Exception c)
     {
         MessageBox.Show(c.Message);
         return;
     }
     finally
     {
         if (result != null)
         {
             MessageBox.Show(result.Message);
             if (result.Status == Models.ActionResult.Success)
             {
                 GetPeopleGroupList();
             }
         }
     }
 }