// GET: Category  where user id==current user id
        public ActionResult Index()
        {
            ClaimsPrincipal currentUser = User;

            var userId = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value;

            CategoryExpenseClient client = new CategoryExpenseClient();

            ViewBag.CategoryExpenselist = client.GetCategoryExpenseList(userId);

            return(View());
        }
Esempio n. 2
0
        public List <SelectListItem> GetCategoryExpenseList(string id)
        {
            CategoryExpenseClient         ac         = new CategoryExpenseClient();
            IEnumerable <CategoryExpense> enumerable = ac.GetCategoryExpenseList(id);
            var types    = new List <SelectListItem>();
            var iterator = 0;

            foreach (var el in enumerable)
            {
                iterator++;
                types.Add(new SelectListItem()
                {
                    Text = el.Name.ToString(), Value = el.Id.ToString()
                });
            }



            return(types);
        }