public async Task <IActionResult> GetUsers([FromBody] User user) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var users = await PrimeApps.GetAllUsers(); return(Ok(users)); }
public async Task <IActionResult> GetUsers([FromBody] User user) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var users = await PrimeApps.GetAllUsers(); var userList = users.Select(usr => (User)usr.ToObject(typeof(User))).ToList(); if (!string.IsNullOrWhiteSpace(user.Email)) { userList = userList.FindAll(x => x.Email == user.Email); } return(Ok(userList)); }