public ActionResult SlideShowCaption(StudentExpressionModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(new StudentModel
                {
                    StudentExpressionType = StudentExpressionType.SlideshowCaption,
                    Id = model.StudentId,
                    TextMaxLength = 35
                }));
            }

            try
            {
                _mediator.Notify(new SaveExpression
                {
                    StudentId = model.StudentId,
                    Text      = model.Text,
                    Type      = StudentExpressionType.SlideshowCaption
                });

                return(RedirectToAction("SlideShowCaption", new { Id = model.StudentId })
                       .WithSuccess("Your \"Slide Show Caption\" has been saved."));
            }
            catch (Exception)
            {
                return(RedirectToAction("SlideShowCaption", new { Id = model.StudentId })
                       .WithError("There was a problem. Your \"Slide Show Caption\" was not Saved."));
            }
        }
        public ActionResult Biography(StudentExpressionModel model)
        {
            if (!ModelState.IsValid)
            {
                return
                    (View(new StudentModel
                {
                    StudentExpressionType = StudentExpressionType.Biography,
                    Id = model.StudentId,
                    TextMaxLength = 200
                }));
            }

            try
            {
                _mediator.Notify(new SaveExpression
                {
                    StudentId = model.StudentId,
                    Text      = model.Text,
                    Type      = StudentExpressionType.Biography
                });

                return(RedirectToAction("Biography", new { Id = model.StudentId })
                       .WithSuccess("Your \"Biography\" has been saved."));
            }
            catch (Exception)
            {
                return(RedirectToAction("Biography", new { Id = model.StudentId })
                       .WithError("There was a problem. Your \"Biography\" was not saved."));
            }
        }
示例#3
0
        public ActionResult ExpressionOfThanks(StudentExpressionModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                _mediator.Notify(new SaveExpression
                {
                    StudentId = _currentUser.User.Id,
                    Text      = model.Text,
                    Type      = StudentExpressionType.ThankYou
                });

                return(RedirectToAction <CheckListController>(c => c.ExpressionOfThanks())
                       .WithSuccess("Your \"Expression of Thanks\" has been saved."));
            }
            catch (Exception)
            {
                return(RedirectToAction <CheckListController>(c => c.ExpressionOfThanks())
                       .WithError("There was a problem. Your \"Expression of Thanks\" was not saved."));
            }
        }