public ActionResult <List <object> > GetAdmin(string typename) { List <object> output; Type type = null; try { type = GetTypeCaseInsensitive($"DatabaseWebService.DatabaseObjects.{typename}"); if (type == null) { throw new Exception($"The requested datatype {typename} doesnt exist."); } var instance = Activator.CreateInstance(type); foreach (var(key, value) in Request.Query) { var prop = type.GetProperties().FirstOrDefault(p => p.Name.ToLower().Equals(key.ToLower())); if (prop == null) { continue; } SetValue(prop, instance, value); } output = DbSelector.MatchTemplate(instance); } catch (TargetException) { var text = type.GetProperties().Aggregate("Supplied a faulty object to the Server. The expected Structure is:\n", (current, prop) => current + $"{prop.Name} : {prop.PropertyType.Name}\n"); throw new Exception(text); } return(output); }