protected override Response Handle(Request message) { var activityTypes = this.context.ActivityTypes .AsQueryable() .Include(t => t.User) .AsNoTracking() .Paginate(t => t, message.ActivityTypePaginator); return(new Response { Results = activityTypes.Transform(s => new ActivityTypeItem { Points = s.Points, Name = s.Name, Tag = s.Tag, Unit = s.Unit, CreatedBy = s.User?.Name, CreatedOn = s.CreatedOn, Remarks = s.Remarks, Actions = new ActionList(EditActivityType.Button(s.Id), DeleteActivityType.Button(s.Id)) }), Actions = new ActionList(AddActivityType.Button()), Tabs = TabstripUtility.GetConfigurationTabs <ActivityTypes>() }); }
public async Task <Response> Handle(Request message) { var inbox = await this.context.Inboxes.SingleOrExceptionAsync(t => t.Id == message.InboxId); return(new Response { Name = inbox.Name, Actions = new ActionList(EditInbox.Button(inbox.Id, "Edit")), Tabs = TabstripUtility.GetInboxTabs(typeof(InboxOverview).GetFormId(), inbox.Id), Metadata = new MyFormResponseMetadata { Title = inbox.Email } }); }
public async Task <Response> Handle(Request message) { var linkedFolder = await this.context.LinkedFolders .Include(t => t.Inbox) .SingleOrExceptionAsync(t => t.Id == message.LinkedFolderId); var emailCount = await this.context.ImportedEmails.CountAsync(t => t.LinkedFolderId == message.LinkedFolderId); return(new Response { Tabs = TabstripUtility.GetLinkedFolderTabs(typeof(LinkedFolderOverview).GetFormId(), linkedFolder.Id), Inbox = InboxOverview.Button(linkedFolder.InboxId, linkedFolder.Inbox.Name), NewItemsFolder = linkedFolder.NewItemsFolder, ProcessedItemsFolder = linkedFolder.ProcessedItemsFolder, EmailCount = MyEmails.Button(emailCount.ToString(), linkedFolder.Id), Actions = new ActionList(EditLinkedFolder.Button(linkedFolder.Id), ImportEmails.Button(linkedFolder.Id, "Import emails")), Metadata = new MyFormResponseMetadata { Title = linkedFolder.Name } }); }
public async Task <Response> Handle(Request message) { var inbox = await this.context.Inboxes .Include(t => t.Users) .ThenInclude(t => t.User) .SingleOrExceptionAsync(t => t.Id == message.InboxId); return(new Response { Tabs = TabstripUtility.GetInboxTabs(typeof(Users).GetFormId(), inbox.Id), Actions = new ActionList(AddUser.Button(inbox.Id, "Add user")), Users = inbox.Users.Select(t => new UserRow { Email = t.User.Name, Actions = new ActionList(RemoveUser.Button(t.InboxId, t.UserId, "Remove user").WithAction(FormLinkActions.Run)) }).ToList(), Metadata = new MyFormResponseMetadata { Title = inbox.Name } }); }
protected override Response Handle(Request message) { var leaveTypes = this.context.LeaveTypes .Include(i => i.User) .AsNoTracking() .Paginate(t => t, message.LeaveTypePaginator); return(new Response { Results = leaveTypes.Transform(s => new LeaveTypeItem { Quantity = s.Quantity, Name = s.Name, Tag = s.Tag, CreatedBy = s.User?.Name, CreatedOn = s.CreatedOn, Remarks = s.Remarks, Actions = new ActionList(EditLeaveType.Button(s.Id), DeleteLeaveType.Button(s.Id)) }), Actions = new ActionList(AddLeaveType.Button()), Tabs = TabstripUtility.GetConfigurationTabs <LeaveTypes>() }); }
public async Task <Response> Handle(Request message) { var inbox = await this.context.Inboxes .Include(t => t.LinkedFolders) .SingleOrExceptionAsync(t => t.Id == message.InboxId); var folderIds = inbox.LinkedFolders.Select(t => t.Id).ToList(); var emailCounts = await this.context.ImportedEmails .Where(t => folderIds.Contains(t.LinkedFolderId)) .GroupBy(t => t.LinkedFolderId) .Select(t => new { LinkedFolderId = t.Key, EmailCount = t.Count() }) .ToDictionaryAsync(t => t.LinkedFolderId); return(new Response { Folders = inbox.LinkedFolders.Select(t => new LinkedFolderRow { ProcessedItemsFolder = t.ProcessedItemsFolder, NewItemsFolder = t.NewItemsFolder, EmailCount = MyEmails.Button((emailCounts.GetValueOrDefault(t.Id)?.EmailCount ?? 0).ToString(), t.InboxId), Actions = new ActionList( RemoveLinkedFolder.Button(t.Id), ImportEmails.Button(t.Id, "Import emails")) }).ToList(), Actions = new ActionList(AddLinkedFolder.Button(inbox.Id, "Add new linked folder")), Tabs = TabstripUtility.GetInboxTabs(typeof(LinkedFolders).GetFormId(), inbox.Id), Metadata = new MyFormResponseMetadata { Title = inbox.Email } }); }