public IActionResult GetAllUsers() { try { return(Ok(usersLogic.GetAllUsers())); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
//Manage Users - for the main admin page public ActionResult UsersIndex() { try { using (UsersLogic logic = new UsersLogic()) { return(View("Users", logic.GetAllUsers())); } } catch (Exception) { ViewBag.Error = "We have problem on the server, Please try again later!"; return(View("Partial", new List <User>())); } }
public HttpResponseMessage GetAllUsers() { try { List <UserModel> users = logic.GetAllUsers(); return(Request.CreateResponse(HttpStatusCode.OK, users)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); // For the Development. //return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error, Please try again"); // For the Production. // נחזיר אובייקט אחר מאשר אובייקט החריגה, בכדי לא לחשוף Production-ב // מידע לגבי החריגה } }
//GET v1/users public async Task <IHttpActionResult> GetAllUsers() { return(Ok(await _userLogic.GetAllUsers())); }