public ActionResult ChalangeDetail(int chalangeId)
        {
            var chalange   = _chalangeRepository.GetById(chalangeId);
            var chalangeVM = ChalangeMappers.ChalangeToDetailChalangeVM(chalange);

            return(View("ChalangeDetail", chalangeVM));
        }
예제 #2
0
 public ActionResult Activate(ProposalChalangeAdminViewModel model)
 {
     if (ModelState.IsValid)
     {
         var proposalChalangeId = model.ProposalChalangeId;
         var chalange           = ChalangeMappers.ProposalChalangeVMToChalange(model);
         var result             = _proposalChalangeService.ActivateProposalChalange(proposalChalangeId, chalange);
         //TODO: řešit něco s výsledkem
     }
     return(RedirectToAction("ProposalChalangeManagement"));
 }
예제 #3
0
        public ActionResult ProposalChalangeManagement()
        {
            var proposalChalanges = new List <ProposalChalangeAdminViewModel>();

            foreach (var chalange in _chalangeRepository.GetActivePropousalChalanges())
            {
                proposalChalanges.Add(ChalangeMappers.ProposalChalangeToProposalAdminMap(chalange));
            }

            return(View(proposalChalanges));
        }
예제 #4
0
        public ActionResult ChalangeManagement()
        {
            var chalanges   = _chalangeRepository.GetAllOrderedByDay();
            var chalangesVM = new List <DetailChalangeViewModel>();

            foreach (var chalange in chalanges)
            {
                chalangesVM.Add(ChalangeMappers.ChalangeToDetailChalangeVM(chalange));
            }
            return(View(chalangesVM));
        }
        public ActionResult Index()
        {
            var chalangesVM = new List <ChalangeOverViewViewModel>();

            foreach (var chalange in _chalangeRepository.GetAllOrderedByDay())
            {
                chalangesVM.Add(ChalangeMappers.ChalangeToOverViewMap(chalange));
            }
            ViewBag.OrderByOptions = GetOrderBySelections();

            return(View("Index", chalangesVM));
        }
예제 #6
0
        public ActionResult AddProposalChalange(ProposalChalangeViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = _userRepository.GetById(User.Identity.GetUserId());
                model.User = user;
                var proposalChalange = ChalangeMappers.ProposalChalangeVMToPropChalange(model);
                _chalangeRepository.AddProposalChalange(proposalChalange);
                ViewBag.Message = "Vaš chalange byla odeslána ke schválení";
            }

            return(View("Index"));
        }
예제 #7
0
        public ActionResult Index()
        {
            var user               = _userRepository.GetById(User.Identity.GetUserId());
            var rankedUsers        = _userRepository.GetRankedUser();
            var chalanges          = _chalangeRepository.GetAllOrderedByDay();
            var propousalChalanges = _chalangeRepository.GetActivePropousalChalanges();

            var homePageVM = new HomePageViewModel()
            {
                Chalanges = new List <ChalangeOverViewViewModel>(
                    chalanges.Select(
                        x => ChalangeMappers.ChalangeToOverViewMap(x))),
                UserRanks = new List <UserRankViewModel>(
                    rankedUsers.Select(
                        x => UserMappers.UserToUsersRankMap(x))),
                ProposalChalangesRanks = new List <ProposalChalangeRankViewModel>(
                    propousalChalanges.Select(
                        x => ChalangeMappers.ProposalChalangeToProposalRankMap(x)))
            };

            return(View(homePageVM));
        }