Beispiel #1
0
        // GET: /Account/Opportunities/{id}
        public async Task <ActionResult> Opportunities(Guid id)
        {
            Response.AppendHeader("guid", id.ToString());

            using (var context = await GetCrmContext())
            {
                var query = GetQuery(context);
                var model = query.GetItem(id);

                var viewModel = new AccountReadViewModel
                {
                    Title        = model.Name,
                    Breadcrumb   = new Breadcrumb(),
                    DomainModel  = model,
                    CreateButton = ButtonViewModel.Create(
                        ButtonViewModel.New, "Opportunity",
                        Url.Action("Create", "Opportunity", new { id = model.Id })
                        ),
                    EditButton = ButtonViewModel.Create(
                        ButtonViewModel.Edit, "Account",
                        Url.Action("Edit", "Account", new { id = model.Id }))
                };

                return(View(viewModel));
            }
        }
Beispiel #2
0
        // GET: Invoice/Details/{id}
        public async Task <ActionResult> Details(Guid id)
        {
            Response.AppendHeader("guid", id.ToString());

            using (var context = await GetCrmContext())
            {
                var query = new InvoiceQuery(context);
                var model = query.GetItem(id);

                var viewModel = new InvoiceReadViewModel
                {
                    Title      = model.Name,
                    Invoice    = model,
                    Breadcrumb = new Breadcrumb
                    {
                        Account     = new OpportunityQuery(context).GetParent(model.OpportunityId.Value),
                        Opportunity = new OpportunityQuery(context).GetItem(model.OpportunityId.Value)
                    },
                    Alerts     = CheckForAlerts(model),
                    OpenButton = ButtonViewModel.Create(ButtonViewModel.Open, "CRM", string.Format("https://trueclarity4.crm4.dynamics.com/main.aspx?etc={0}&id={{{1}}}&pagetype=entityrecord", InvoiceEntity.EntityTypeCode, model.Id)),
                    EditButton = ButtonViewModel.Create(ButtonViewModel.Edit, "Invoice", Url.Action("Edit", new { id = model.Id }))
                };

                return(View(viewModel));
            }
        }