public async Task <ActionResult> Clone(int?submissionId) { if (!submissionId.HasValue) { return(RedirectToRoute(SiteRouteNames.App_Submit)); } var submission = await _appService.GetSubmissionAsync(submissionId.Value); // Per the rule in the old site, // if the submission id doesn't refer to a submission in database, // the page will show an empty form and allow user to submit a new app. if (submission == null) { return(RedirectToRoute(SiteRouteNames.App_Submit)); } // Check if current user can clone the app specified by the submission id. // Only the owner and a super submitter can do that. if (!User.IsSuperSubmitter() && !await _submitterService.IsOwnerAsync(User.GetSubmittership().SubmitterID, submission.SubmissionID)) { return(View("NeedPermission")); } var model = AppSubmitViewModel.Clone(submission, await _appService.GetMetadataAsync(submission.SubmissionID), await _appService.GetPackagesAsync(submission.SubmissionID) ); await LoadViewDataForSubmit(); return(View("Submit", model)); }