// GET: Category where user id==current user id public ActionResult Index() { ClaimsPrincipal currentUser = User; var userId = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value; CategoryIncomeClient client = new CategoryIncomeClient(); ViewBag.CategoryIncomelist = client.GetCategoryIncomeList(userId); return(View()); }
public List <SelectListItem> GetCategoryIncomeList(string id) { CategoryIncomeClient ac = new CategoryIncomeClient(); IEnumerable <CategoryIncome> enumerable = ac.GetCategoryIncomeList(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); }