List<Patientmain> list = patientmains.OrderBy(p => p.Firstname).ThenBy(p => p.Middlename).ThenBy(p => p.Lastname).ToList();