Example #1
0
        public String GetCategoryName(int CategoryId)
        {
            CategoryExpenseClient ac       = new CategoryExpenseClient();
            CategoryExpense       category = ac.Find(CategoryId);

            return(category.Name);
        }
        public ActionResult Edit(CategoryExpense CEVM)
        {
            CategoryExpenseClient client = new CategoryExpenseClient();

            client.Edit(CEVM);
            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(int id)
        {
            CategoryExpenseClient client = new CategoryExpenseClient();

            client.Delete(id);
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(CategoryExpense CategoryExpense)
        {
            CategoryExpenseClient client = new CategoryExpenseClient();

            client.Create(CategoryExpense);
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(int id)
        {
            CategoryExpenseClient    client = new CategoryExpenseClient();
            CategoryExpenseViewModel CEVM   = new CategoryExpenseViewModel();

            CEVM.CategoryExpense = client.Find(id);
            return(View("Edit", CEVM.CategoryExpense));
        }
        // 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());
        }
Example #7
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);
        }