Thursday, June 2, 2016

The best overloaded method match for 'System.Math.Round(double, int)' has some invalid arguments cannot convert from 'float?' to 'double'

sol: double xx= (double)xx[0].xxxxx;

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.