Exemplo n.º 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
         List <CustomerFeedbackRes> lstResult = new List <CustomerFeedbackRes>();
         var lstData = MemoryInfo.GetAllCustomerFeedback();
         if (lstData != null)
         {
             lstData = lstData.Where(x => x.IsDeleted != null && x.IsDeleted != 1).ToList();
         }
         foreach (var item in lstData)
         {
             var customer             = MemoryInfo.GetCustomer(item.IdCustomer);
             CustomerFeedbackRes temp = new CustomerFeedbackRes(item, customer);
             lstResult.Add(temp);
         }
         var res = new RequestErrorCode(true, null, null);
         res.ListDataResult.AddRange(lstResult);
         return(Ok(res));
     }
     catch (Exception ex)
     {
         Logger.Write(ex.ToString());
     }
     return(BadRequest("Unknow"));
 }