using System; using System.Collections.Generic; using System.Linq; using Luticate2.Auth.Dbo.Tokens; using Luticate2.Auth.Dbo.Users; using Luticate2.Utils.Dbo.Basic; using Luticate2.Utils.Dbo.Result; using Luticate2.Utils.Utils; namespace Luticate2.Auth.Business { public static class LuBusinessExtensions { public static IEnumerable ToLite(this IEnumerable userRes) { return userRes.Select(fullDbo => fullDbo.ToLite()); } public static LuResult ToLite(this LuResult userRes) { return userRes.To(dbo => dbo.ToLite()); } public static LuResult> ToLite(this LuResult> userRes) { return userRes.To(dbo => dbo.To(dbos => dbos.ToLite().ToList())); } public static LuUsersDbo ToLite(this LuUsersFullDbo dbo) { if (dbo == null) { return null; } return new LuUsersDbo { Id = dbo.Id, Username = dbo.Username };//TODO } public static LuUsersTokenDbo ToUserToken(this LuTokensDbo dbo) { if (dbo == null) { return null; } return new LuUsersTokenDbo { Data = dbo.Data, NotAfter = dbo.NotAfter, NotBefore = dbo.NotBefore, UserId = dbo.UserId }; } } }