예제 #1
0
        public async Task <ActionResult> VoteOnNomination(VoteViewModel voteViewModel)
        {
            if (voteViewModel.Vote.Id != 0)
            {
                VoteAPI.Update(voteViewModel.Vote);
            }
            else if (voteViewModel.Vote.Id == 0)
            {
                VoteAPI.Create(voteViewModel.Vote);
            }
            ;
            Nomination nomination = await NominationAPI.GetById(voteViewModel.Vote.NominationId);

            YearCategoryModel returnParameters   = new YearCategoryModel(nomination.Year, nomination.AwardCategory);
            Nomination        nominationVotedFor = await NominationAPI.GetById(voteViewModel.Vote.NominationId);

            RecommendationViewModel recommendationViewModel = new RecommendationViewModel()
            {
                Year     = nominationVotedFor.Year,
                Category = nominationVotedFor.AwardCategory
            };

            recommendationViewModel.Movie = await MovieAPI.GetById(nominationVotedFor.MovieId);

            recommendationViewModel.MovieId = recommendationViewModel.Movie.Id;
            return(RedirectToAction(nameof(MovieRecommendation), recommendationViewModel));
        }
예제 #2
0
        public ActionResult Actions()
        {
            var msg = new JsonMessage();
            var url = Request.Form.ToString();

            switch (DoAction)
            {
            case ActionType.Add:
                msg = _api.Add(url);
                break;

            case ActionType.Edit:
                msg = _api.Update(url);
                break;

            case ActionType.Delete:
                var lst1 = string.Join(",", ArrId);
                _api.Delete(lst1);
                msg.Message = "Cập nhật thành công.";
                break;

            default:
                msg.Message = "Bạn chưa được phân quyền cho chức năng này.";
                msg.Erros   = true;
                break;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult Actions()
        {
            var msg = new JsonMessage();
            var url = Request.Form.ToString();

            switch (DoAction)
            {
            case ActionType.Add:
                msg = _api.Add(url);
                break;

            case ActionType.Edit:
                msg = _api.Update(url);
                break;

            default:
                msg.Message = "Không có hành động nào được thực hiện.";
                msg.Erros   = true;
                break;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }