public IList <UsersEmergencyContactViewModel> GetEmergencyContactByUserID(Guid UserID) { IList <UsersEmergencyContactViewModel> emergencyContacts = new List <UsersEmergencyContactViewModel>(); try { emergencyContacts = _context.usp_UsersEmergencyContact_GetByUserID(UserID) .Select(x => new UsersEmergencyContactViewModel { Id = x.Id, Name = x.Name, Mobile = x.Mobile, WorkMobile = x.WorkMobile, Notes = x.Notes, Relationship = x.Relationship, IsActive = x.IsActive, UserID = x.UserID, CreatedBy = x.CreatedBy, UpdatedBy = x.UpdatedBy, CreatedDate = x.CreatedDate, UpdatedDate = x.UpdatedDate }).ToList(); } catch (Exception ex) { throw ex; } return(emergencyContacts); }