public static IEnumerable <ActionDesciptor> ToActionDesciptors(this IEnumerable <ResourceModel> resources) { if (resources.IsNullOrEmpty() || ActionDesciptors.IsNullOrEmpty()) { return(Anonymous.NewEnumerable <ActionDesciptor>()); } return(from n in resources let contains = ActionDesciptors.Any(g => g.AggregateId == n.AggregateId) let tor = contains ? ActionDesciptors.FirstOrDefault(g => g.AggregateId == n.AggregateId) : new ActionDesciptor() where contains == true select new ActionDesciptor() { AggregateId = n.AggregateId, ActionResult = tor.ActionResult, Area = tor.Area, Controller = tor.Controller }); }
public IEnumerable <ModelValidationResult> ValidateModel(object model) { if (model == null) { return(Anonymous.NewEnumerable <ModelValidationResult>()); } var validation = this.validator.Validate(model); if (validation.IsValid) { return(Anonymous.NewEnumerable <ModelValidationResult>()); } var array = validation.Errors.Select(t => new ModelValidationResult(t.MemberName, t.ErrorMessage) { }).ToArray(); return(array); }
private AppUser GetUserOnDebug(string userName) { return(new AppUser() { UserName = userName, NickName = userName, AggregateId = userName, GroupSort = GroupSort.Muggle, Resources = B2C.Admin.Web.Permissions.StartupExtension.ActionDesciptors ?? Anonymous.NewEnumerable <ActionDesciptor>() }); }