Seats will be null if you call the method without matching data / query argument. You need to also check that, like so for instance:
[HttpPost] public String Indexhome( IEnumerable<Seat> Seats ) { if ((Seats == null) || !Seats.Any(s => s.IsSelected)) { return "you didnt select any seats"; } else { return "you selected " + string.Join(", ", Seats.Where(s => s.IsSelected).Select(s => s.Name)); } }
Related Posts:
- How to fix No connection could be made because the target machine actively refused it 127.0.0.1:64527
- failed to load resource: the server response with a status 500 (internal server error)
- ASP.NET 5 MVC: unable to connect to web server ‘IIS Express’
- Why is this code throwing an InvalidOperationException?
- Twilio TwilioRestClient does not contain a definition for SendSmsMessage
- System.web.mvc missing
- Compiler Error Message: The compiler failed with error code -2146232576
- How can I secure passwords stored inside web.config?
- Process exists with ExitCode 255
- ASP.NET MVC Page Won’t Load and says “The resource cannot be found”
- How do I target @Model within a src of an image tag?
- HTML.ActionLink method
- Could not load file or assembly ‘Microsoft.Web.Infrastructure,
- Styles.Render in MVC4
- What does ModelState.IsValid do?
- There is no ViewData item of type ‘IEnumerable
‘ that has the key country - The model item passed into the dictionary is of type .. but this dictionary requires a model item of type
- CS1617: Invalid option ‘6’ for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default
- Convert from List into IEnumerable format
- The name ‘ViewBag’ does not exist in the current context – Visual Studio 2015
- Authorization has been denied for this request – New Web API Project
- How to make Check Box List in ASP.Net MVC
- Effectively use async/await with ASP.NET Web API
- How can I convert String to Int?
- How to find child of a GameObject or the script attached to child GameObject via script
- Process cannot access the file because it is being used by another proess
- How to convert JSON to XML or XML to JSON?
- Virustotal Trapmine suspicious.low.ml.score
- Convert int to string?
- Unity OnTriggerEnter2D not registering
- How to Sort a List
by a property in the object - The page was not displayed because the request entity is too large on IIS
- How to open .dll files to see what is written inside?
- Extension methods must be defined in a non-generic static class
- Return multiple values to a method caller
- Regex that accepts only numbers (0-9) and NO characters
- Wait one second in running program
- How to resolve this System.IO.FileNotFoundException
- Fire ontextchanged() event of an asp:TextBox via Javascript
- C# Gridview CheckBox Field VS (Template Field + CheckBox)
- Extension methods must be defined in a non-generic static class
- Convert char to int in C#
- The remote server returned an error: (403) Forbidden
- How to add a delay for a 2 or 3 seconds
- Multiple file-extensions searchPattern for System.IO.Directory.GetFiles
- calling javascript function on OnClientClick event of a Submit button
- C# – Illegal characters in path
- Getting The ASCII Value of a character in a C# string
- The data types text and varchar are incompatible in the equal to operator in C#
- Name does not exist in the current context
- Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host
- The remote server returned an error: (407) Proxy Authentication Required
- IsNumeric function in c#
- The calling thread must be STA, because many UI components require this in WPF
- The entity type
is not part of the model for the current context - Error when Building Project: Error building Player because scripts have compile errors in the editor
- Unity3D. Trying to send command for object without authority
- The type initializer for ‘MyClass’ threw an exception
- The server committed a protocol violation. Section=ResponseStatusLine ERROR
- Specified cast is not valid.. how to resolve this
- C# switch on type
- How to post JSON to a server using C#?
- C# Error (Cannot Implicitly convert type ‘string’ to ‘int’)
- EF CodeFirst: Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong
- How can I cast int to enum?
- What is the C# equivalent of friend?
- How to get relative path of a file in visual studio?
- Error Message: Type or namespace definition, or end-of-file expected
- Make first letter of a string upper case (with maximum performance)
- ‘An exception occurred during a WebClient request” while using C# ASP.NET
- How to download image from URL
- Visual Studio keeps crashing
- Is there an equivalent to the Scanner class in C# for strings?
- The opposite of the modulo operator?
- How can I implement static methods on an interface?
- How to add List<> to a List<> in asp.net [duplicate]
- get path for my .exe
- AddTransient, AddScoped and AddSingleton Services Differences
- Critical error detected c0000374 – C++ dll returns pointer off allocated memory to C#
- Linq select objects in list where exists IN (A,B,C)
- Unable to determine the principal end of an association between the types
- What is a quick way to force CRLF in C# / .NET?
- How to enable assembly bind failure logging (Fusion) in .NET
- How to make inline functions in C#
- Create html documentation for C# code
- C# Convert List
to Dictionary - Using FolderBrowserDialog in WPF application
- Differences between SFTP and “FTP over SSH”
- When should I use a List vs a LinkedList
- Remove punctuation from string with Regex
- Unity – How to stop Play Mode in case of infinite loop?
- Go To Definition: “Cannot navigate to the symbol under the caret.”
- Why am I getting an Exception with the message “Invalid setup on a non-virtual (overridable in VB) member…”?
- Is there a keyboard shortcut to maximize the Game window in Unity in Play Mode?
- IF Statement multiple conditions, same statement
- What is the easiest way to handle associative array in c#?
- What does the M stand for in C# Decimal literal notation?
- Iif equivalent in C#
- Convert an array to string
- is inaccessible due to its protection level