WIP
This commit is contained in:
parent
54b057886c
commit
7fc1ae0650
204 changed files with 4345 additions and 134 deletions
|
|
@ -0,0 +1,43 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.ApplicationInsights;
|
||||
|
||||
namespace PlanTempus.Application.Components
|
||||
{
|
||||
public class OrganizationViewComponent : ApiViewComponentBase
|
||||
{
|
||||
private readonly TelemetryClient _telemetry;
|
||||
|
||||
public OrganizationViewComponent(
|
||||
IHttpClientFactory httpClientFactory,
|
||||
TelemetryClient telemetry)
|
||||
: base(httpClientFactory, telemetry)
|
||||
{
|
||||
_telemetry = telemetry;
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync(int organizationId, bool showDetailedView = true)
|
||||
{
|
||||
_telemetry.TrackEvent($"{GetType().Name}Invoked", new Dictionary<string, string>
|
||||
{
|
||||
["OrganizationId"] = organizationId.ToString(),
|
||||
["ShowDetailedView"] = showDetailedView.ToString()
|
||||
});
|
||||
|
||||
var organization = await GetJObjectFromApiAsync($"/api/organization/get/{organizationId}");
|
||||
|
||||
if (organization == null)
|
||||
return HandleError("Organization not found");
|
||||
|
||||
ViewBag.ShowDetailedView = showDetailedView;
|
||||
|
||||
|
||||
_telemetry.TrackEvent("Viewed", new Dictionary<string, string>
|
||||
{
|
||||
["OrganizationId"] = organizationId.ToString(),
|
||||
["Name"] = organization["name"]?.ToString()
|
||||
});
|
||||
|
||||
return View(organization);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue