Exemple #1
0
        public IHttpActionResult GetAllPaymentTypes()
        {
            try
            {
                IList <PaymentTypeViewModels> paymentTypeList = new List <PaymentTypeViewModels>();
                IEnumerable <PaymentType>     lstPaymentType;

                lstPaymentType = _paymentType.GetPaymentTypes();

                foreach (var paymentType in lstPaymentType)
                {
                    PaymentTypeViewModels paymentTypeVM = new PaymentTypeViewModels();
                    paymentTypeVM.id       = paymentType.Id;
                    paymentTypeVM.isActive = paymentType.IsActive;
                    paymentTypeVM.name     = paymentType.Name;
                    paymentTypeVM.code     = paymentType.Code;

                    paymentTypeList.Add(paymentTypeVM);
                }
                var messageData  = new { code = ReadOnlyValue.SuccessMessageCode, message = ReadOnlyValue.MessageSuccess };
                var returnObject = new { paymentTypeList = paymentTypeList, messageCode = messageData };
                return(Ok(returnObject));
            }
            catch (Exception ex)
            {
                string errorLogId   = _eventLogService.WriteLogs(User.Identity.Name, ex, MethodBase.GetCurrentMethod().Name);
                var    messageData  = new { code = ReadOnlyValue.ErrorMessageCode, message = String.Format(ReadOnlyValue.MessageTaskmateError, errorLogId) };
                var    returnObject = new { messageCode = messageData };
                return(Ok(returnObject));
            }
        }