This commit is contained in:
mmrbnjd
2024-05-08 17:25:02 +03:30
parent d74f3dadf3
commit 716f02baa1
14 changed files with 376 additions and 179 deletions

View File

@@ -23,8 +23,9 @@
@item.CustomAttributes.Where(w => w.AttributeType.Name == "DisplayAttribute").Select(s => s.NamedArguments.Where(w => w.MemberName == "Name").Select(ss => ss.TypedValue.Value).First()).First().ToString()
</th>
}
}
<th>عملیات</th>
}
</tr>
</thead>
@@ -32,20 +33,34 @@
@{
foreach (var item in ModelinComponent)
{
<tr>
<tr>
@{
properties = item.GetType().GetProperties();
int id = 0;
foreach (PropertyInfo property in properties)
{
if (property.Name.ToLower()=="id")
id =Convert.ToInt32(property.GetValue(item, null));
if (property.CustomAttributes.Any(w => w.AttributeType.Name == "DisplayAttribute"))
{
<td>@property.GetValue(item, null)</td>
}
}
}
if (id>0)
{
<td><button @onclick="()=>OnMultipleOfThree.InvokeAsync(Convert.ToInt32(id))" type="button" class="btn btn-link">ویرایش</button></td>
}
else
{
<td><button type="button" class="btn btn-link disabled">ویرایش</button></td>
}
}
</tr>
}
}
</tbody>
</table>
@@ -62,5 +77,5 @@
@code {
[Parameter]
public List<T> ModelinComponent { get; set; } = new List<T>();
[Parameter] public EventCallback<int> OnMultipleOfThree { get; set; }
}