예제 #1
0
        public PartialViewResult _WizardTitleScreen(RantViewModel viewModel, string prevBtn, string nextBtn)
        {
            if (nextBtn != null && ModelState.IsValid)
            {
                Rant modelRant = viewModel.CurrentRant;

                if (modelRant == null)
                {
                    return(PartialView(viewModel));
                }

                Rant newRant = GetRantSession();
                newRant.EmotionId = viewModel.Emotions.SelectedItemId;
                viewModel.Emotions.EmotionItems = (List <SelectListItem>)TempData["emotionItems"];

                string emotionType = viewModel.Emotions.EmotionItems.FirstOrDefault(
                    e => e.Value == newRant.EmotionId.ToString()).Text;

                newRant.Title = string.Format("I'm {0} {1}", emotionType, modelRant.Title);

                return(PartialView("_WizardTellUsMoreScreen", viewModel));
            }

            return(PartialView());
        }
예제 #2
0
        public ActionResult _WizardTellUsMoreScreen(RantViewModel viewModel,
                                                    string prevBtn, string nextBtn)
        {
            Rant newRant = GetRantSession();

            if (prevBtn != null)
            {
                if (viewModel.CurrentRant == null)
                {
                    viewModel.CurrentRant = new Rant();
                }

                TempData["emotionItems"] = viewModel.Emotions.EmotionItems;

                return(View("Create", viewModel));
            }

            if (nextBtn != null && ModelState.IsValid)
            {
                Rant modelRant = viewModel.CurrentRant;

                if (modelRant == null)
                {
                    return(PartialView(viewModel));
                }

                newRant.Description = viewModel.CurrentRant.Description;

                return(PartialView("_WizardReactionTypeExpectedScreen", viewModel));
            }

            return(PartialView(this));
        }
예제 #3
0
        public ActionResult _WizardReactionTypeExpectedScreen(RantViewModel viewModel,
                                                              string prevBtn, string nextBtn)
        {
            Rant newRant = GetRantSession();

            if (prevBtn != null)
            {
                if (viewModel.CurrentRant == null)
                {
                    viewModel.CurrentRant = new Rant();
                }

                return(View("Create", viewModel));
            }

            if (nextBtn != null && ModelState.IsValid)
            {
                Rant modelRant = viewModel.CurrentRant;

                if (modelRant == null)
                {
                    return(PartialView(viewModel));
                }

                newRant.ExpectedReactionRequest = viewModel.CurrentRant.ExpectedReactionRequest;

                return(RedirectToAction("_WizardSummary", viewModel));
            }

            return(PartialView(this));
        }
예제 #4
0
        // GET: Rant
        public ActionResult Index()
        {
            RantViewModel viewModel = new RantViewModel(_repository);

            viewModel.Rants = viewModel.GetRants()
                              .OrderByDescending(r => r.PostDate)
                              .ThenBy(r => r.Title)
                              .ToList();

            return(View(viewModel));
        }
예제 #5
0
        public PartialViewResult _WizardSummary(RantViewModel viewModel)
        {
            if (viewModel == null)
            {
                viewModel = new RantViewModel(_rantRepository, _emotionRepository);
            }

            if (viewModel != null)
            {
                viewModel.CurrentRant = GetRantSession();
                return(PartialView("_WizardSummary", viewModel));
            }

            return(PartialView(this));
        }
예제 #6
0
        public ActionResult Details(int?id)
        {
            RantViewModel viewModel = new RantViewModel(_rantRepository);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (ModelState.IsValid)
            {
                Rant rant = viewModel.GetRantById((int)id);
                return(View(rant));
            }

            return(RedirectToAction("Index"));
        }
예제 #7
0
        public ActionResult _WizardSummary(RantViewModel viewModel, string prevBtn, string doneBtn)
        {
            if (prevBtn != null)
            {
                // TODO: Redirect
                return(null);
            }

            if (doneBtn != null && ModelState.IsValid)
            {
                viewModel.CurrentRant          = GetRantSession();
                viewModel.CurrentRant.PostDate = DateTime.Now.ToLocalTime();
                viewModel.SaveRant(viewModel.CurrentRant);
                return(RedirectToAction("Index", "Home"));
            }

            // TOOD
            return(null);
        }
예제 #8
0
        public PartialViewResult _WizardTitleScreen(RantViewModel viewModel)
        {
            if (viewModel == null)
            {
                viewModel = new RantViewModel(_rantRepository, _emotionRepository);
            }

            if (viewModel != null)
            {
                if (viewModel.CurrentRant == null)
                {
                    viewModel.CurrentRant = new Rant();
                }

                TempData["emotionItems"] = viewModel.Emotions.EmotionItems;

                return(PartialView("_WizardTitleScreen", viewModel));
            }

            return(PartialView(this));
        }
예제 #9
0
        public ViewResult Create()
        {
            RantViewModel viewModel = new RantViewModel(_rantRepository, _emotionRepository);

            return(View(viewModel));
        }