Пример #1
0
 public async Task <IHttpActionResult> Get()
 {
     try
     {
         #region token
         var header = Request.Headers;
         if (header.Authorization == null)
         {
             return(StatusCode(HttpStatusCode.Unauthorized));
         }
         var      token = header.Authorization.Parameter;
         Employee employee;
         if (string.IsNullOrWhiteSpace(token) || !TokenManager.ValidateToken(token, out employee))
         {
             return(StatusCode(HttpStatusCode.Unauthorized));
         }
         #endregion
         var lstData = MemoryInfo.GetAllEmployee();
         foreach (var item in lstData)
         {
             item.Password = null;
             if (item.IsDeleted == 1)
             {
                 lstData.Remove(item);
             }
         }
         var res = new RequestErrorCode(true, null, null);
         res.ListDataResult.AddRange(lstData);
         return(Ok(res));
     }
     catch (Exception ex)
     {
         Logger.Write(ex.ToString());
     }
     return(BadRequest("Unknow"));
 }