public async Task <IActionResult> OnPost()
        {
            var newOpportunity = new Opportunity();

            newOpportunity.Title       = Title;
            newOpportunity.Description = Description;
            newOpportunity.EMailAddressOfOpportunityContact = EmailOfOpportunityContact;
            newOpportunity.FullAddress = FullAddressOfOpportunity;
            newOpportunity.ImmunityProofRequirements = ImmunityProofRequirements;
            newOpportunity.ExpirationDate            = ExpirationDate;
            newOpportunity.OpportunityPageUri        = OpportunityPageUri;

            //TODO: note... this is currently a mock instance that we'll want to replace with Google Maps
            await Task.WhenAll(
                Task.Run(async() => { newOpportunity.LocationOfOpportunity = (await Getgeocoding()).Coordinate; }),
                Task.Run(async() => { newOpportunity.CompanyLogo = await UploadLogo(); })
                );

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await OpportunityDataAccess.UpsertOpportunity(newOpportunity);

            await SendConfirmationEmail(newOpportunity);

            return(RedirectToPage("Confirmation"));
        }
Пример #2
0
 public async Task TestAddOpportunity()
 {
     var opportunity
         = await OpportunityDataAccess.UpsertOpportunity(
               Opportunity
               );
 }