transport loading order status in brisanje

This commit is contained in:
David Štaleker
2023-06-26 08:12:25 +02:00
parent 25e98d63ec
commit 625b013b67
13 changed files with 2405 additions and 26 deletions

View File

@@ -75,8 +75,8 @@ namespace EveryThing.Pages.Invoices
ViewData["States"] = new SelectList(Enum.GetValues(typeof(Models.Invoice.Invoice.InvoiceState))
.Cast<Models.Invoice.Invoice.InvoiceState>()
.Where(x => GetAttribute<Models.Invoice.Invoice.InvoiceStateAttribute>(x).AllowedTypes.Split(',').Contains(((int)Invoice.Type).ToString()))
.Select(x => new { Name = GetAttribute<DisplayAttribute>(x).Name, Value = x.ToString()})
.Where(x => Classes.Global.GetAttribute<Models.Invoice.Invoice.InvoiceStateAttribute>(x).AllowedTypes.Split(',').Contains(((int)Invoice.Type).ToString()))
.Select(x => new { Name = Classes.Global.GetAttribute<DisplayAttribute>(x).Name, Value = x.ToString()})
.ToList(), "Value", "Name");
if (!string.IsNullOrEmpty(Request.Headers["Referer"]))
@@ -87,13 +87,7 @@ namespace EveryThing.Pages.Invoices
return Page();
}
public static TAttribute GetAttribute<TAttribute>(Enum value)
where TAttribute : Attribute
{
var enumType = value.GetType();
var name = Enum.GetName(enumType, value);
return enumType.GetField(name).GetCustomAttributes(false).OfType<TAttribute>().SingleOrDefault();
}
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://aka.ms/RazorPagesCRUD.