Пример #1
0
        public ActionResult <IEnumerable <PaymentType> > GetPaymentTypes()
        {
            var returnTypes = paymentTypeRepository.GetPaymentTypes();

            if (returnTypes != null)
            {
                return(Ok(returnTypes));
            }
            else
            {
                return(NotFound());
            }
        }
Пример #2
0
 public IActionResult Get()
 {
     try
     {
         var paymentTypes = _paymentTypeRepository.GetPaymentTypes();
         var results      = Mapper.Map <IEnumerable <PaymentTypeDto> >(paymentTypes);
         return(Ok(results));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed in Get /PaymentTypes: {ex}");
         return(BadRequest());
     }
 }
        public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page)
        {
            ViewBag.CurrentSort = sortOrder;
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;

            var paymentTypes = paymentTypeRepository.GetPaymentTypes();

            #region search

            if (!String.IsNullOrEmpty(searchString))
            {
                paymentTypes = paymentTypes.Where(p => p.Activity.Name.ToLower().Contains(searchString.ToLower()));
            }
            #endregion

            #region OrderBy
            ViewBag.ActivitySortParm    = String.IsNullOrEmpty(sortOrder) ? "activity_desc" : "";
            ViewBag.DescriptionSortParm = sortOrder == "description_asc" ? "description_desc" : "description_asc";
            ViewBag.StatusSortParm      = sortOrder == "status_asc" ? "status_desc" : "status_asc";
            ViewBag.MonthsSortParm      = sortOrder == "months_asc" ? "months_desc" : "months_asc";

            switch (sortOrder)
            {
            case "activity_desc":
                paymentTypes = paymentTypes.OrderByDescending(p => p.Activity.Name);
                break;

            case "description_desc":
                paymentTypes = paymentTypes.OrderByDescending(p => p.Description);
                break;

            case "description_asc":
                paymentTypes = paymentTypes.OrderBy(p => p.Description);
                break;

            case "status_desc":
                paymentTypes = paymentTypes.OrderByDescending(p => p.Status);
                break;

            case "status_asc":
                paymentTypes = paymentTypes.OrderByDescending(p => p.Status);
                break;

            case "months_desc":
                paymentTypes = paymentTypes.OrderBy(p => p.DurationInMonths);
                break;

            case "months_asc":
                paymentTypes = paymentTypes.OrderByDescending(p => p.DurationInMonths);
                break;

            default:
                paymentTypes = paymentTypes.OrderBy(p => p.Activity.Name);
                break;
            }
            #endregion

            int pageNumber = (page ?? 1);
            int pageSize   = ConfigurationManager.AppSettings["PageSize"] != null?Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]) : 8;

            return(View(paymentTypes.ToPagedList(pageNumber, pageSize)));
        }
Пример #4
0
 // GET: PaymentTypePrices/Create
 public ActionResult Create()
 {
     ViewBag.PaymentTypeID = new SelectList(paymentTypeRepository.GetPaymentTypes(), "PaymentTypeID", "Description");
     return(View());
 }
Пример #5
0
 // GET: Payments/Create
 public ActionResult Create()
 {
     ViewBag.ClientID      = new SelectList(clientRepository.GetClients(), "ClientID", "FirstName");
     ViewBag.PaymentTypeID = new SelectList(paymentTypeRepository.GetPaymentTypes(), "PaymentTypeID", "Description");
     return(View());
 }