Wonky.Client/Wonky.Client/Pages/CrmTaskItemViewPage.razor.cs
2022-12-03 12:37:45 +01:00

58 lines
No EOL
2 KiB
C#

// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpInterfaces;
using Wonky.Client.HttpRepository;
using Wonky.Entity.DTO;
namespace Wonky.Client.Pages;
public partial class CrmTaskItemViewPage : IDisposable
{
[Parameter] public string TaskItemId { get; set; }
[Inject] public HttpInterceptorService _interceptor { get; set; }
[Inject] public ICrmTaskItemHttpRepository CrmTaskItemRepo { get; set; }
private TaskItemDto _taskItem = new ();
private EditContext _editContext { get; set; }
private bool Working { get; set; } = true;
protected override async Task OnParametersSetAsync()
{
_interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent();
_taskItem = await CrmTaskItemRepo.GetTaskItem(TaskItemId);
Console.WriteLine(JsonSerializer.Serialize(_taskItem));
Working = false;
}
protected override void OnInitialized()
{
_editContext = new EditContext(_taskItem);
}
public void Dispose()
{
_interceptor.DisposeEvent();
}
}