Ejemplo n.º 1
0
        public RedirectToActionResult Redirect(string id, int notificationCardId,
                                               string For, int ForId)
        {
            if (For == "Video")
            {
                NotificationCard card = repository.NotificationCards
                                        .FirstOrDefault(c => c.NotificationCardId == notificationCardId);
                if (card.NotificationViews.FirstOrDefault(v => v.UserId == id) == null)
                {
                    repository.NewNotificationCardView(notificationCardId, id);
                }

                return(RedirectToAction("Index", "Recorder",
                                        new { id, videoId = ForId }));
            }
            else if (For == "Course")
            {
                NotificationCard card = repository.NotificationCards
                                        .FirstOrDefault(c => c.NotificationCardId == notificationCardId);
                if (card.NotificationViews.FirstOrDefault(v => v.UserId == id) == null)
                {
                    repository.NewNotificationCardView(notificationCardId, id);
                }

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

            else if (For == "Group")
            {
                NotificationCard card = repository.NotificationCards
                                        .FirstOrDefault(c => c.NotificationCardId == notificationCardId);
                if (card.NotificationViews.FirstOrDefault(v => v.UserId == id) == null)
                {
                    repository.NewNotificationCardView(notificationCardId, id);
                }

                return(RedirectToAction("GroupDetails", "Groups", new
                {
                    id,
                    groupId = ForId
                }));
            }

            return(RedirectToAction("Error", "Error",
                                    new { id, errMsg = "" }));
        }