public static void ClassInit(TestContext testContext) { CreateOrg(); query = new OpportunityQuery(context); deleteAllOpportunities(); deleteAllTestAccounts(); }
//GET: /Opportunity/Invoices/{id} public async Task <ActionResult> Invoices(Guid id) { Response.AppendHeader("guid", id.ToString()); using (var context = await GetCrmContext()) { var query = new OpportunityQuery(context); var model = query.GetItem(id); var viewModel = new OpportunityReadViewModel { Title = model.Name, Opportunity = model, Breadcrumb = new Breadcrumb { Account = query.GetParent(id) } }; return(View(viewModel)); } }
protected override void RefreshCreateViewModel(CrmContext context, Guid?parentId, ref InvoiceWriteViewModel model) { if (!parentId.HasValue) { throw new ArgumentNullException("Invoice requires a ParentId."); } var opportunityId = parentId.Value; var opportunity = new OpportunityQuery(context).GetItem(opportunityId); model.Title = "Create Invoice"; model.OpportunityId = opportunity.Id.Value; model.OpportunityLookup = new InvoiceQuery(context).GetParentLookup(opportunityId); model.FormButtons = new FormButtons(GetParentUrl(parentId)); model.Breadcrumb = new Breadcrumb { Account = new OpportunityQuery(context).GetParent(opportunityId), Opportunity = opportunity }; }