Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Move the .ToList() in ShowController.UserShows() to after the .Select(). The ToList() enumerates the results, so what you're doing is pulling all the data in, then projecting it into viewmodels. Do it the other way round, and it'll get SQL to do the projecting, and pull in only what it needs. As a general rule, do .ToList() as late as possible.
Please tell me you aren't sending user credentials as URL parameters. Even if it's not over the internet. Even if it's not actually across a network, but just localhost. That password will be in the clear, in log files, in multiple places, several of which are not generally protected. User credentials should be sent in the body, over a properly-secured connection, using TLS.
@Liren same effect from opposite routes. The .Contains() is checking "does that collection contain this character" while the .Any() is checking "are any of the characters in this collection the same as this one". They end up doing the same thing, but you're doing with .Where() and .Any() is to manually do what .Contains() is actually intended for.
True, but I tend to work with arrays when going back and forth between string and a bunch of chars. No real reason; mostly just because there's a specific ToCharArray() and out of left-over habits from other languages.
@JeroenVannevel I would argue that the exception to that rule is when the class represents a string-like thing, like a StringBuilder, or some sort of character array. In that case, toString() is a logical choice for getting the resultant string.