public async Task <IActionResult> Create(ProposalFormModel model)
        {
            if (!await this.ValidateUserIsMemberOfOpportunityAsync(model.OpportunityId))
            {
                return(Unauthorized());
            }

            if (model.File != null && (!model.File.FileName.EndsWith(".pdf") || model.File.Length > DataConstants.UploadFileLenght))
            {
                ModelState.AddModelError("File", "File should be .pdf, no larger than 5 MB in size!");
            }

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.proposals.CreateAsync(
                model.Name,
                model.Value,
                model.Margin,
                model.OpportunityId,
                model.File);

            TempData.AddSuccessMessage($"Proposal {model.Name} created successfully!");
            return(RedirectToAction(controllerName: "Opportunities", actionName: nameof(OpportunitiesController.Details), routeValues: new { id = model.OpportunityId }));
        }
        public async Task <IActionResult> Create(int opportunityId)
        {
            if (!await this.ValidateUserIsMemberOfOpportunityAsync(opportunityId))
            {
                return(Unauthorized());
            }

            var model = new ProposalFormModel
            {
                OpportunityId = opportunityId
            };

            return(View(model));
        }