Ejemplo n.º 1
0
        public UserInvites_InviteViewModel(Invite invite)
        {
            if (invite != null)
            {
                Id = invite.Id;
                FullName = invite.FullName;
                Email = invite.Email;
                State = invite.GetStateSting();
                CreationDate = invite.CreationDate;

                if(invite.State == (byte)InviteState.Used) {
                    UserUrl = UrlHelper.GetUrl<User>(invite.InvitedUser.Id);
                    var theUser = DataService.PerThread.BaseUserSet.OfType<User>().SingleOrDefault(u => u.Id == invite.InvitedUser.Id);
                    if (theUser != null)
                        UserAvatar = ImageService.GetImageUrl<User>(theUser.Avatar);
                }

                if (invite.State == (byte)InviteState.NotSent || invite.State == (byte)InviteState.Sent)
                    if (DateTime.Now - invite.CreationDate > ConstHelper.MinInviteResendInterval)
                        IsResendEnabled = true;
            }
        }