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"));
        }
Exemplo n.º 2
0
 public async Task TestAddOpportunity()
 {
     var opportunity
         = await OpportunityDataAccess.UpsertOpportunity(
               Opportunity
               );
 }
        public int SaveOpportunity(Entity.Sales.Opportunity Model)
        {
            OpportunityDbModel DbModel = new OpportunityDbModel();

            Model.CopyPropertiesTo(DbModel);
            return(OpportunityDataAccess.SaveOpportunities(DbModel));
        }
        public List <Entity.Sales.CommitStage> GetCommitStage()
        {
            List <Entity.Sales.CommitStage> CommitStageList = new List <Entity.Sales.CommitStage>();

            OpportunityDataAccess.GetCommitStage().CopyListTo(CommitStageList);
            return(CommitStageList);
        }
        public List <Entity.Sales.GetOpportunity> GetAllOpportunity(Entity.Sales.GetOpportunityParam Param)
        {
            List <Entity.Sales.GetOpportunity> AllOpportunityList = new List <Entity.Sales.GetOpportunity>();
            GetOpportunityParamDbModel         p = new GetOpportunityParamDbModel();

            Param.CopyPropertiesTo(p);
            OpportunityDataAccess.GetAllOpportunities(p).CopyListTo(AllOpportunityList);
            return(AllOpportunityList);
        }
Exemplo n.º 6
0
        public async Task TestDeleteOpportunity()
        {
            await OpportunityDataAccess.DeleteOpportunity(
                Opportunity.DeleteId
                );

            //assumes immediate vs. eventual consistency
            var deletedOpportunity = await FindById(Opportunity.OpportunityId);

            Assert.IsFalse(deletedOpportunity.Active);
        }
Exemplo n.º 7
0
        public async Task TestActivateOpportunity()
        {
            await OpportunityDataAccess.ActivateOpportunity(
                Opportunity.ActivationId
                );

            //assumes immediate vs. eventual consistency
            var activatedOopportunity = await FindById(Opportunity.OpportunityId);

            Assert.IsTrue(activatedOopportunity.Active);
        }
 public int DeleteOpportunities(int Id)
 {
     return(OpportunityDataAccess.DeleteOpportunities(Id));
 }
 public Entity.Sales.Opportunity GetOpportunityById(int Id, int SourceTypeId, int ChildTypeId)
 {
     Entity.Sales.Opportunity Opportunity = new Entity.Sales.Opportunity();
     OpportunityDataAccess.GetOpportunityById(Id, SourceTypeId, ChildTypeId).CopyPropertiesTo(Opportunity);
     return(Opportunity);
 }
Exemplo n.º 10
0
        public static List <Opportunity> GetOpportunities()
        {
            OpportunityDataAccess o = new OpportunityDataAccess();

            return(o.GetOpportunities());
        }
Exemplo n.º 11
0
 private async Task <Opportunity> FindById(Guid opportunityId)
 {
     return(await OpportunityDataAccess.FindOpportunityById(
                Opportunity.OpportunityId
                ));
 }
Exemplo n.º 12
0
        public async Task FindOpportunityByEditId()
        {
            var opportunity = await OpportunityDataAccess.FindOpportunityByEditId(Opportunity.EditId);

            Assert.IsNotNull(opportunity);
        }