public async Task <ActionResult> Register([ModelBinder(typeof(RegisterViewModelCustomBinder))] RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                UserDTO userDto = new UserDTO
                {
                    Email           = model.Email,
                    Password        = model.Password,
                    FullName        = model.FullName,
                    UserName        = model.Email,
                    IsTermsAccepted = model.IsTermsAccepted,
                    Role            = "student"
                };
                OperationDetails operationDetails = await UserService.Create(userDto);

                if (operationDetails.Succedeed)
                {
                    ClaimsIdentity claim = await UserService.Authenticate(userDto);

                    if (claim == null)
                    {
                        ModelState.AddModelError("", "Wrong login/password.");
                    }
                    else
                    {
                        AuthenticationManager.SignOut();
                        AuthenticationManager.SignIn(new AuthenticationProperties
                        {
                            IsPersistent = true
                        }, claim);

                        userDto = UserService.FindByEMail(model.Email);
                        TTService.AddStudent(new StudentDTO {
                            UserId = userDto.Id
                        });

                        return(RedirectToAction("Index", "Home"));
                    }
                }

                else
                {
                    ModelState.AddModelError(operationDetails.Property, operationDetails.Message);
                }
            }
            return(View(model));
        }
        private async void btnCheckin_Holding(object sender, HoldingRoutedEventArgs e)
        {
            switch (e.HoldingState)
            {
            case HoldingState.Started:
                this.Status = HoldButtonStatus.Waiting;
                this.PulseAnimation.Begin();
                break;

            case HoldingState.Completed:
                this.CompletedAnimation.Begin();

                TTService service = new TTService();

                this.ButtonTopText.Text          = "waiting";
                this.ButtonBottomText.Visibility = Visibility.Collapsed;

                DateTime?date = await service.CheckInOrOutAsync();

                if (date.HasValue)
                {
                    this.ButtonTopText.Text          = "CHECKED";
                    this.ButtonBottomText.Visibility = Visibility.Visible;
                    this.ButtonBottomText.Text       = ((DateTime)date).ToString("HH:mm:ss");
                }
                else
                {
                    this.CompletedAnimation.Begin();
                    this.ButtonTopText.Text          = "try again";
                    this.ButtonBottomText.Visibility = Visibility.Collapsed;
                    await Task.Delay(500);

                    if (this.Status == HoldButtonStatus.Waiting)
                    {
                        this.ButtonTopText.Text          = this.topText;
                        this.ButtonBottomText.Text       = this.bottonText;
                        this.ButtonBottomText.Visibility = Visibility.Visible;
                    }
                }

                this.Status = HoldButtonStatus.Idle;
                break;

            case HoldingState.Canceled:
                this.ButtonTopText.Text    = this.topText;
                this.ButtonBottomText.Text = this.bottonText;

                if (String.IsNullOrEmpty(this.ButtonBottomText.Text))
                {
                    this.ButtonBottomText.Visibility = Visibility.Collapsed;
                }
                else
                {
                    this.ButtonBottomText.Visibility = Visibility.Visible;
                }

                this.Status      = HoldButtonStatus.Idle;
                this.Circle.Fill = new SolidColorBrush(Colors.LightPink);
                this.CanceledAnimation.Begin();
                break;
            }
        }