public async Task <ActionResult <IEnumerable <Model.AuthUserFace> > > GetAuthUserFace([FromQuery] Model.SearchRequest.AuthUserFaceSearchRequest search) { var result = await _context.AuthUserFace.ToListAsync(); if (search != null) { if (search.AuthUserId > 0) { result = result.Where(r => r.AuthUserId == search.AuthUserId).ToList(); } if (search.PresenceId > 0) { result = result.Where(r => r.PresenceId == search.PresenceId).ToList(); } if (search.onlyOne != null) { if (search.onlyOne == true) { if (result.Count > 0) { List <AuthUserFace> l = new List <AuthUserFace>(); l.Add(result[0]); return(_mapper.Map <List <Model.AuthUserFace> >(l)); } } } } return(_mapper.Map <List <Model.AuthUserFace> >(result)); }
public async Task <ActionResult <IEnumerable <Model.AuthUserImage> > > GetAuthUserImage([FromQuery] Model.SearchRequest.AuthUserFaceSearchRequest search) { var userImages = await _context.AuthUserImage.ToListAsync(); if (search != null) { if (search.AuthUserId != 0) { userImages = userImages.Where(u => u.AuthUserId == search.AuthUserId).ToList(); } } return(_mapper.Map <List <Model.AuthUserImage> >(userImages)); }