当前位置: 首页>>代码示例>>C#>>正文


C# User.ReinstateFromDelete方法代码示例

本文整理汇总了C#中User.ReinstateFromDelete方法的典型用法代码示例。如果您正苦于以下问题:C# User.ReinstateFromDelete方法的具体用法?C# User.ReinstateFromDelete怎么用?C# User.ReinstateFromDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User.ReinstateFromDelete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: When_Delete_Then_should_set_correct_properties

        public void When_Delete_Then_should_set_correct_properties()
        {
            // Given
            var user = new User { Id = Guid.NewGuid() };
            var userDeleting = new UserForAuditing();

            user.Delete(userDeleting);

            // When
            user.ReinstateFromDelete(userDeleting);

            // Then
            Assert.That(user.Deleted, Is.False);
            Assert.That(user.LastModifiedBy, Is.EqualTo(userDeleting));
            Assert.That(user.LastModifiedOn.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:16,代码来源:ReinstateFromDeleteTests.cs

示例2: Given_user_and_employee_deleted_When_ReinstateFromDelete_Then_employee_should_be_restored

        public void Given_user_and_employee_deleted_When_ReinstateFromDelete_Then_employee_should_be_restored()
        {
            // Given
            var user = new User
            {
                Id = Guid.NewGuid()
                ,
                Employee = new Employee() { Deleted = true }
                ,
                Deleted = true
            };
            var userDeleting = new UserForAuditing();

            // When
            user.ReinstateFromDelete(userDeleting);

            // Then
            Assert.That(user.Employee.Deleted, Is.False);
            Assert.That(user.Employee.LastModifiedBy, Is.EqualTo(userDeleting));
            Assert.That(user.Employee.LastModifiedOn.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:21,代码来源:ReinstateFromDeleteTests.cs

示例3: ReinstateUser

        private void ReinstateUser(User userToReinstate, Guid? actioningUserId)
        {
            if (userToReinstate != null && userToReinstate.Deleted)
            {
                var actioningUser = actioningUserId.HasValue ? _auditedUserRepository.GetById(actioningUserId.Value) : _auditedUserRepository.GetSystemUser();
                userToReinstate.ReinstateFromDelete(actioningUser);
                _userRepository.SaveOrUpdate(userToReinstate);

                _bus.Send(new ReinstateUser { UserId = userToReinstate.Id, ActioningUserId = actioningUser.Id });

                if (userToReinstate.IsRegistered == false)
                {
                    _bus.Send(new UpdateUserRegistration
                    {
                        UserId = userToReinstate.Id,
                        ActioningUserId = actioningUser.Id,
                        SecurityAnswer =
                            String.IsNullOrEmpty(userToReinstate.Employee.MainContactDetails.Telephone1)
                                ? userToReinstate.Employee.MainContactDetails.Telephone2
                                : userToReinstate.Employee.MainContactDetails.Telephone1,
                        Email = userToReinstate.Employee.MainContactDetails.Email
                    });
                }
            }
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:25,代码来源:UserService.cs


注:本文中的User.ReinstateFromDelete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。