Beispiel #1
0
 public ActionResult SignupForm(UserResponses userResponse)
 {
     if (ModelState.IsValid)
     {
         return(View("ThankYou", userResponse));
     }
     else
     {
         return(View());
     }
 }
Beispiel #2
0
        public void All_Users_Returns_Ok_Result()
        {
            // Act
            ActionResult <UserResponses> okResult = control.TestGetAll();

            // Assert
            Assert.IsType <OkObjectResult>(okResult.Result);

            UserResponses user_test = (UserResponses)((OkObjectResult)okResult.Result).Value;

            //Assert list is type <List<User>
            Assert.IsType <List <User> >(user_test.Data);

            //Assert list is not empty
            Assert.NotEmpty(user_test.Data);
        }
Beispiel #3
0
        public ActionResult <UserResponses> GetAll()
        {
            try
            {
                UserResponses      responses = new UserResponses();
                MongoCursor <User> users     = context.User.FindAll();
                if (users.Count() == 0)
                {
                    return(NotFound(new { Message = Constants.Empty_List }));
                }
                responses.Data = users.ToList();

                responses.Status = true;

                return(Ok(responses));
            }
            catch (Exception ex)
            {
                Log.LogError(ex);
                return(StatusCode(500, ex.ToString()));
            }
        }
        public WpfDialog(string title, string description, WpfDialogOptions options)
        {
            InitializeComponent();

            DialogTitle = title;
            Description = description;

            if (options != null)
            {
                if (options.CustomContent != null)
                {
                    UserContentArea.Children.Clear();
                    UserContentArea.Children.Add(options.CustomContent);
                }
                else
                {
                    UserContentArea.Visibility = Visibility.Collapsed;
                }

                if (options.PossibleResponses != null)
                {
                    buttonPanel.Children.Clear();

                    UserResponses responses = options.PossibleResponses;
                    for (int responseNum = 0; responseNum < responses.ResponseNames.Length; responseNum++)
                    {
                        Button btnResponse = new Button();
                        btnResponse.Content  = responses.ResponseNames[responseNum];
                        btnResponse.Height   = 23;
                        btnResponse.MinWidth = 70;
                        btnResponse.Click   += new RoutedEventHandler(btnResponse_Click);

                        if (responseNum == responses.DefaultResponseIndex)
                        {
                            btnResponse.IsDefault = true;
                        }

                        // Only set the margin on the
                        if (responseNum != responses.ResponseNames.Length)
                        {
                            btnResponse.Margin = new Thickness(0, 0, 5, 0);
                        }

                        buttonPanel.Children.Add(btnResponse);
                    }
                }

                if (options.TitleBarIcon != null)
                {
                    this.Icon = options.TitleBarIcon;
                }

                if (options.DialogIcon != null)
                {
                    iconImage.Source = options.DialogIcon;
                }
                else
                {
                    StockIcons icons = new StockIcons();
                    StockIcon  icon  = icons.Info;

                    if (options.DialogType == DialogType.Question)
                    {
                        icon = icons.Help;
                    }
                    else if (options.DialogType == DialogType.Error)
                    {
                        icon = icons.Error;
                    }
                    else if (options.DialogType == DialogType.Warning)
                    {
                        icon = icons.Warning;
                    }

                    // This is an example of how to load a bitmap using a pack formatted string.
                    //resourceImage = @"Helpers\UIHelpers\Images\question.png";
                    //BitmapImage bitmapImage = new BitmapImage(new Uri(String.Format("pack://application:,,,/{0}", resourceImage)));

                    iconImage.Source = icon.BitmapSource;
                }
            }

            this.DataContext = this;
        }