- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
public IQueryable<AuditEntry> ViewAudit()
{
var items = _operationEntities.AuditItems.AsQueryable();
return items.Select((item) => new AuditEntry()
{
OperationID = item.Id,
CreationTime = item.CreationTime,
Description = item.AuditItemType.StringFormat.Replace(
"{0}", item.InsertionStrings.Where((x) => x.StringId == 0).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{1}", item.InsertionStrings.Where((x) => x.StringId == 1).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{2}", item.InsertionStrings.Where((x) => x.StringId == 2).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{3}", item.InsertionStrings.Where((x) => x.StringId == 3).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{4}", item.InsertionStrings.Where((x) => x.StringId == 4).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{5}", item.InsertionStrings.Where((x) => x.StringId == 5).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{6}", item.InsertionStrings.Where((x) => x.StringId == 6).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{7}", item.InsertionStrings.Where((x) => x.StringId == 7).Select((x) => x.String).FirstOrDefault() ?? String.Empty),
CreatedBy = item.CreatedBy,
OperationType = item.AuditItemType.MessageType.Name,
OperationCategory = item.AuditItemType.AuditCategory.Name,
});
}
Паровозик. Реализация string.Format() в виде linq-запроса