Thursday, June 2, 2016

ERROR : The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[class]', but this dictionary requires a model item of type 'class'.

SOLUTION :

    public CLASSNAME gEtsinglerecord(int Id)
        {
            CLASSNAME retval = null;
            retval = Entity.CLASSNAME.Where(s => s.Id == Id).FirstOrDefault();
            return retval;
        }


We have to use "First or Default( )" to the get record based on SINGLE ID value.