Checking for nulls in ASP.NET MVC Controllers

Posted by Brian McCord on Stack Overflow See other posts from Stack Overflow or by Brian McCord
Published on 2010-06-01T22:11:26Z Indexed on 2010/06/01 22:13 UTC
Read the original article Hit count: 199

Filed under:
|
|

Another opinion question:

What is the proper (in your opinion) to check for nulls in an MVC controller. For instance, if you have an edit controller that fetches a record from the db based on an id, what do you do if that record is not found? I found this article, but I'm not sure I like that method. Do you just check for it with an if statement and redirect to a 404 page? What solution do you use?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about null