Beispiel #1
0
        public ActionResult Content(ContentViewModel contentVM)
        {
            var comment   = contentVM.Subscription.Comment;
            var rating    = contentVM.Subscription.Rate;
            var courseId  = contentVM.Course.Id;
            int accountId = ((Account)Session[UserType.LoggedInUser.ToString()]).Id;


            if (!String.IsNullOrEmpty(comment) && rating != null)
            {
                ElearnerDataLayoutActions.SaveSubscriptionChanges(courseId, accountId, comment, rating);
                TempData["Comment"] = true;
                TempData["Rating"]  = true;
            }
            else if (!String.IsNullOrEmpty(comment))
            {
                ElearnerDataLayoutActions.SaveSubscriptionChanges(courseId, accountId, comment, rating);
                TempData["Comment"] = true;
                TempData["Rating"]  = false;
            }
            else if (rating != null)
            {
                ElearnerDataLayoutActions.SaveSubscriptionChanges(courseId, accountId, comment, rating);
                TempData["Comment"] = false;
                TempData["Rating"]  = true;
            }
            else
            {
                TempData["Comment"] = false;
                TempData["Rating"]  = false;
            }


            return(RedirectToAction("Content", "Courses", new { id = courseId }));
        }