ChangeInvoiceType(Invoice invoiceitem, InvoiceType item, bool action = true)
{
string old = invoiceitem.invoiceType.GetEnumDisplayName();
invoiceitem.invoiceType = item;
@@ -226,8 +226,19 @@ namespace Back.Services
UserID = invoiceitem.LastChangeUserID
});
if (action)
- return await _invoiceRepo.UpdateAsync(invoiceitem);
- else return true;
+ {
+ var result = await _invoiceRepo.UpdateAsync(invoiceitem);
+ if (result)
+ {
+ return await GetInvoice(invoiceitem.CompanyID.Value, invoiceitem.ID);
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+ else return await GetInvoice(invoiceitem.CompanyID.Value, invoiceitem.ID);
//_contextMongodb.InsertItem(new SysLog()
//{
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
@@ -249,7 +260,7 @@ namespace Back.Services
// Route = _httpContextAccessor.HttpContext.Request.Path,
// Type = "catch"
//});
- return false;
+ return null;
}
diff --git a/TaxPayerFull/Layout/NavMenu.razor b/TaxPayerFull/Layout/NavMenu.razor
index 53cf2fe..e6c2b86 100644
--- a/TaxPayerFull/Layout/NavMenu.razor
+++ b/TaxPayerFull/Layout/NavMenu.razor
@@ -10,7 +10,7 @@
+ @* @if (invoice.BillReference.HasValue)
+ {
+
+
+
+ } *@
+
@if (InvoiceID == 0 || InvoiceID == null)
@@ -337,6 +344,27 @@
}
+ private async Task ChangeStatus(InvoiceType type)
+ {
+ var rsp = await hc.Post($"Invoice/ChangeInvoiceType/{InvoiceID}",type);
+ if (rsp.IsSuccessStatusCode)
+ {
+ var resinvoice = await rsp.Content.ReadFromJsonAsync();
+ if (resinvoice!=null)
+ {
+ invoice = resinvoice;
+ ShowSuccessAlert("تغییر وضعیت با موفقیت انجام شد");
+ }
+ else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
+ }
+ else
+ {
+ var request = await rsp.Content.ReadFromJsonAsync>();
+ ShowDangerAlert(request[0]);
+ }
+
+ }
+
private async Task LoadData()
{
PreloadService.Show(SpinnerColor.Dark);
diff --git a/TaxPayerFull/Program.cs b/TaxPayerFull/Program.cs
index f8805c2..628e6c3 100644
--- a/TaxPayerFull/Program.cs
+++ b/TaxPayerFull/Program.cs
@@ -34,9 +34,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
}) ;
-//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
+builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
-builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
+//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");