Mistři v programování na #hovnokod

C# #4183

@model Tuple<IEnumerable<string>, IEnumerable<Device>, IEnumerable<Device>>

@{
     Func<string, int> one = a =>
                                 {
                                     var f = Model.Item3.FirstOrDefault(b => b.Name == a);                               
                                    return (f == null ? 0 :f.ID);
                           };

    Func<string, string> two = t =>
                                   {
                                       var f = Model.Item2.FirstOrDefault(b => b.Name == t);
                                       return (f == null ? string.Empty : "-active");
                                   };                                                     
    var gridModel= Model.Item1.Select(a => new {Name = a, Id = one(a), Active= two(a)}).Where(b=>!string.IsNullOrWhiteSpace(b.Active)).OrderBy(a=>a.Name);
    
}

Anonymous,