public ActionResult PaymentCategories()
 {
     using (var svc = new TransactionDescriptionServiceClient())
     {
         var model = GetAllCategories(svc);
         return View(model);
     }
 }
        private TransactionCategoriesViewModel GetAllCategories(TransactionDescriptionServiceClient svc)
        {
            var model = new TransactionCategoriesViewModel
            {
                Categories = new List<Model.TransactionCategoriesModel>()
            };
            var descriptions = svc.GetAllTransactionCategories(true);
            model.Categories = descriptions;

            return model;
        }
 public ActionResult CreateCategory(SingleCategoryViewModel viewModel)
 {
     using (var svc = new TransactionDescriptionServiceClient())
     {
         var item = new CategoryModel
         {
             Name = viewModel.Name,
             Description = viewModel.Category
         };
         svc.AddTransactionCategory(item);
         var model = GetAllCategories(svc);
         return View("Index", model);
     }
 }
 public ActionResult AddPaymentCategory(int? DescriptionId)
 {
     using (var svc = new TransactionDescriptionServiceClient())
     {
         var model = new SingleCategoryViewModel();
         if (DescriptionId.HasValue)
         {
             var description = svc.GetTransactionCategoriesById(DescriptionId.Value);
             model.Name = description.Name;
             ;
         }
         return View("NewCategory", model);
     }
 }
 public bool Updatecategories()
 {
     using (var svc = new TransactionDescriptionServiceClient())
     {
         try
         {
             svc.UpdateAllCategories();
             return true;
         }
         catch (Exception)
         {
             return false;
         }
     }
 }
        public static TransactionFilterViewModel GetFilterModel()
        {
            var model = new TransactionFilterViewModel
            {
                CategoryItems = new List<SelectListItem>()
            };
            using (var svc = new TransactionDescriptionServiceClient())
            {
                var items = svc.GetAllTransactionCategories(false);
                model.CategoryItems.Add(new SelectListItem { Text = "Select item...", Value = "-1" });
                foreach (var transactionCategoriesModel in items)
                {
                    model.CategoryItems.Add(new SelectListItem { Text = transactionCategoriesModel.Name, Value = transactionCategoriesModel.Id.ToString() });
                }
            };

            return model;
        }