Example #1
0
 public IHttpActionResult GetAllNotices(int userID)
 {
     try
     {
         var list = _noticeService.GetAllNotices(userID);
         return(Ok(list));
     }
     catch (Exception ex)
     {
         var text = ex.Message + " " + ex.StackTrace.ToString();
         _logService.AddError(text, userID);
         return(InternalServerError());
     }
 }
Example #2
0
 public IHttpActionResult GetUsers(int userID)
 {
     try
     {
         var list = _userService.GetUsers();
         if (list.Count == 0)
         {
             return(NotFound());
         }
         return(Ok(list));
     }
     catch (Exception ex)//catch any exception this is an antipatern any exxception shold be threated deiferent
     {
         var text = ex.Message + " " + ex.StackTrace.ToString();
         _logService.AddError(text, userID);
         return(InternalServerError()); //user shuld not know what is wrong, admin should only know
     }
 }