public async Task <IHttpActionResult> Get()
 {
     try
     {
         var lstData = MemoryInfo.GetAllPayment();
         if (lstData != null)
         {
             lstData = lstData.Where(x => x.IsDeleted != null && x.IsDeleted != 1).ToList();
         }
         List <PaymentRes> lstResult = new List <PaymentRes>();
         foreach (var payment in lstData)
         {
             if (payment.IsDeleted != 1)
             {
                 var lstPaymentFees = MemoryInfo.GetListPaymentFeeByField(payment.Id.ToString(),
                                                                          PaymentFee.PaymentFeeFields.IdPayment);
                 PaymentRes itemRes = new PaymentRes(payment, lstPaymentFees);
                 lstResult.Add(itemRes);
             }
         }
         var res = new RequestErrorCode(true, null, null);
         res.ListDataResult.AddRange(lstResult);
         return(Ok(res));
     }
     catch (Exception ex)
     {
         Logger.Write(ex.ToString());
     }
     return(BadRequest("Unknow"));
 }
예제 #2
0
 public async Task <IHttpActionResult> Get()
 {
     try
     {
         var lstData = MemoryInfo.GetAllContract();
         List <ContractRes> lstResult = new List <ContractRes>();
         if (lstData != null)
         {
             lstData = lstData.Where(x => x.IsDeleted != null && x.IsDeleted != 1).ToList();
         }
         var lstPayment = MemoryInfo.GetAllPayment();
         foreach (var item in lstData)
         {
             List <Payment> payments = new List <Payment>();
             payments = lstPayment.Where(x => x.IdContract == item.Id).ToList();
             var         customer = MemoryInfo.GetCustomer(item.IdCustomer);
             ContractRes temp     = new ContractRes(item, customer, payments);
             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"));
 }