public static AppModel MapFromEntity(App entity) { var model = new AppModel { Id = entity.Id, Email = entity.UserEmail, IsActive = entity.IsActive, Name = entity.Name, Description = entity.Description, Url = entity.Url != null && entity.Url.StartsWith("http") ? entity.Url : string.Format("http://{0}", entity.Url) }; var tokens = entity.Tokens.Where(x => !x.IsDeleted); foreach (var token in tokens) { model.Tokens.Add(new TokenModel { CreationDate = token.CreatedAt, UsageCount = token.UsageCount, Token = token.Key }); } return model; }
public static AppModel MapFromEntity(App entity) { var model = new AppModel(); model.Id = entity.Id; model.Email = entity.UserEmail; model.IsActive = entity.IsActive; model.Name = entity.Name; model.Description = entity.Description; model.Url = entity.Url; var tokens = entity.Tokens.Where(x => !x.IsDeleted); foreach (var token in tokens) { model.Tokens.Add(new TokenModel { CreationDate = token.CreatedAt, UsageCount = token.UsageCount, Token = token.Key }); } return model; }