Example #1
0
        public async Task <ActionResult> CreateValue(GameFieldDropdownValueCreateViewModel viewModel)
        {
            try
            {
                var field = await ProjectRepository.GetProjectField(viewModel.ProjectId, viewModel.ProjectFieldId);

                var timeSlotOptions = viewModel.GetTimeSlotRequest(field, Request.Form["TimeSlotStartTime"].FirstOrDefault());

                await
                FieldSetupService.CreateFieldValueVariant(
                    new CreateFieldValueVariantRequest(
                        viewModel.ProjectId,
                        viewModel.Label,
                        viewModel.Description,
                        viewModel.ProjectFieldId,
                        viewModel.MasterDescription,
                        viewModel.ProgrammaticValue,
                        viewModel.Price,
                        viewModel.PlayerSelectable,
                        timeSlotOptions));

                return(RedirectToAction("Edit", new { viewModel.ProjectId, projectFieldId = viewModel.ProjectFieldId }));
            }
            catch (Exception ex)
            {
                ModelState.AddException(ex);
                return(View(viewModel));
            }
        }
        public async Task <ActionResult> CreateValue(GameFieldDropdownValueCreateViewModel viewModel)
        {
            try
            {
                await
                FieldSetupService.CreateFieldValueVariant(
                    new CreateFieldValueVariantRequest(
                        viewModel.ProjectId,
                        viewModel.Label,
                        viewModel.Description,
                        viewModel.ProjectFieldId,
                        viewModel.MasterDescription,
                        viewModel.ProgrammaticValue,
                        viewModel.Price,
                        viewModel.PlayerSelectable));

                return(RedirectToAction("Edit", new { viewModel.ProjectId, projectFieldId = viewModel.ProjectFieldId }));
            }
            catch
            {
                return(View(viewModel));
            }
        }