Ejemplo n.º 1
0
 public IActionResult GetAllUsers()
 {
     try
     {
         return(Ok(usersLogic.GetAllUsers()));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }
Ejemplo n.º 2
0
 //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>()));
     }
 }
Ejemplo n.º 3
0
 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-ב
         // מידע לגבי החריגה
     }
 }
Ejemplo n.º 4
0
 //GET v1/users
 public async Task <IHttpActionResult> GetAllUsers()
 {
     return(Ok(await _userLogic.GetAllUsers()));
 }