Пример #1
0
        public ActionResult LogbookEntry(Guid logbookEntryId)
        {
            ViewBag.BackLinkHtml = MenuConstructor.ConstructHtmlBackLink("LogbookEntry", logbookEntryId);
            var entry = DataAccess.GetLogbookEntry(logbookEntryId);
            var model = new LogbookEntryViewModel();

            model.Notes          = entry.Notes;
            model.EntryDate      = entry.EntryDate;
            model.Logbook        = DataAccess.GetLogbook(entry.LogbookId);
            model.ActivityId     = entry.ActivityId;
            model.LogbookEntryId = logbookEntryId;
            // format the option selections for readability.
            var fields = DataAccess.GetSelectedFields(logbookEntryId);
            Dictionary <string, string> selectedFieldText = new Dictionary <string, string>();

            foreach (var f in fields)
            {
                if (selectedFieldText.ContainsKey(f.FieldName))
                {
                    selectedFieldText[f.FieldName] += ", " + f.OptionText;
                }
                else
                {
                    selectedFieldText.Add(f.FieldName, f.OptionText);
                }
            }
            model.SelectedFields = selectedFieldText.Select(f => new SelectedFieldOption()
            {
                FieldName = f.Key, OptionText = f.Value
            }).ToArray();
            return(View(model));
        }
Пример #2
0
        public ActionResult EditFieldOption(Guid fieldOptionId)
        {
            ViewBag.BackLinkHtml = MenuConstructor.ConstructHtmlBackLink("EditFieldOption", fieldOptionId);
            var model = new EditFieldOptionViewModel();
            var dto   = DataAccess.GetFieldOption(fieldOptionId);

            model.FieldOptionId = fieldOptionId;
            model.Text          = dto.Text;
            return(View(model));
        }
Пример #3
0
        public ActionResult EditActivity(Guid activityId)
        {
            ViewBag.BackLinkHtml = MenuConstructor.ConstructHtmlBackLink("EditActivity", activityId);
            var model = new EditActivityViewModel();
            var dto   = DataAccess.GetActivity(activityId);

            model.Name        = dto.Name;
            model.Description = dto.Description;
            model.ImageUrl    = dto.ImageUrl;
            model.Fields      = DataAccess.GetFields(activityId);
            return(View(model));
        }
Пример #4
0
        public ActionResult Logbook(Guid logbookId)
        {
            ViewBag.BackLinkHtml = MenuConstructor.ConstructHtmlBackLink("Logbook", logbookId);
            var logbook    = new LogbookViewModel();
            var logbookDTO = DataAccess.GetLogbook(logbookId);

            logbook.Name        = logbookDTO.Name;
            logbook.Activity    = DataAccess.GetActivity(logbookDTO.DefaultActivityId).Name;
            logbook.LastUpdated = logbookDTO.UpdateDate;
            logbook.LogbookId   = logbookDTO.LogbookId;
            logbook.Entries     = DataAccess.GetLogbookEntries(logbook.LogbookId);
            return(View(logbook));
        }
Пример #5
0
        public ActionResult EditField(Guid fieldId)
        {
            ViewBag.BackLinkHtml = MenuConstructor.ConstructHtmlBackLink("EditField", fieldId);
            var model = new EditFieldViewModel();
            var dto   = DataAccess.GetField(fieldId);

            model.FieldId       = dto.FieldId;
            model.Name          = dto.Name;
            model.AllowFreeText = dto.AllowFreeText;
            model.IsMultiSelect = dto.IsMultiSelect;
            model.IsRequired    = dto.IsRequired;
            model.FieldOptions  = DataAccess.GetFieldOptions(fieldId);
            return(View(model));
        }
Пример #6
0
    public static void Main()
    {
        string[]        options = new string[] { "1. New Game", "2. Load Game", "3. Exit" };
        MenuConstructor menu    = new MenuConstructor();

        menu.Display(options, "RPG GAME", 0);
        switch (menu.GetUserSelectedOption())
        {
        case 1:
            Console.WriteLine("You have selected option nr. 1");
            break;

        case 2:
            Console.WriteLine("You have selected option nr. 2");
            break;

        case 3:
            Console.WriteLine("You have selected option nr. 3");
            break;
        }
    }