public IActionResult UpdateSubmissionPage(int submissionid)
        {
            var submission_detail = new SubmissionDetailModel
            {
                statuses   = _status.GetSubmissionStatuses(),
                submission = _submissions.Get(submissionid)
            };

            return(View(submission_detail));
        }
        public IActionResult CreatePage(int caseId)
        {
            var model = new SubmissionDetailModel
            {
                banks      = _banks.GetAll(),
                submission = new Submission
                {
                    Case = _cases.Get(caseId)
                },
                previous_submissions = _submissions.GetSubmissionsForCase(caseId)
            };

            return(View(model));
        }
        public IActionResult UpdateSubmission(int submissionid, string statusname, [Bind("OfferedAmount, OfferedPeriod, OfferedInterestRate, BankDoc")] SubmissionDetailModel submissionDetail)
        {
            Submission thisSubmission = _submissions.Get(submissionid);
            Status     thisStatus     = _status.Get(statusname);

            thisSubmission.Status              = thisStatus;
            thisSubmission.OfferedAmount       = submissionDetail.OfferedAmount;
            thisSubmission.OfferedInterestRate = submissionDetail.OfferedInterestRate;
            thisSubmission.OfferedPeriod       = submissionDetail.OfferedPeriod;
            thisSubmission.BankResponseDoc     = submissionDetail.BankDoc;
            _submissions.SaveChanges();


            return(RedirectToAction("CreatePage", "Submissions", new { caseId = thisSubmission.Case.Id }));
        }
Пример #4
0
        // GET: /Status/ShowSubmission?id={SubmissionID}
        public ActionResult ShowSubmission()
        {
            // 检查查询参数。
            if (string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                return(Redirect("~/Status"));
            }

            int submissionId;

            if (!int.TryParse(Request.QueryString["id"], out submissionId))
            {
                return(Redirect("~/Status"));
            }

            SubmissionHandle submissionHandle = SubmissionManager.Default.QuerySubmissionById(submissionId);

            if (submissionHandle == null)
            {
                // 给定的用户提交不存在。
                return(Redirect("~/Status"));
            }

            // 验证操作权限。
            using (SubmissionDataProvider submissionData = SubmissionDataProvider.Create(submissionHandle, true))
            {
                if (submissionData.ContestId != -1)
                {
                    ContestHandle contestHandle = new ContestHandle(submissionData.ContestId);
                    using (ContestDataProvider contestData = ContestDataProvider.Create(contestHandle, true))
                    {
                        if (contestData.Status != ContestStatus.Ended &&
                            string.Compare(submissionData.Username, UserSession.GetUsername(Session)) != 0)
                        {
                            return(Redirect(Request.UrlReferrer.ToString()));
                        }
                    }
                }
            }

            SubmissionDetailModel model = SubmissionDetailModel.FromSubmissionHandle(submissionHandle);

            return(View(model));
        }