public IList <BloodGroupVM> GetBloodGroupList() { List <BloodGroupVM> BloodGroupList = new List <BloodGroupVM>(); using (StudentsEntities context = new StudentsEntities()) { var result = context.BloodGroupList().ToList(); foreach (var item in result.ToList()) { BloodGroupList.Add(new BloodGroupVM { BloodGroupId = item.BloodGroupId, BloodGroupName = item.BloodGroupName }); } return(BloodGroupList); } }