コード例 #1
0
        public async Task <ActionResult> AddBalanceEntry(string id = "")
        {
            AddEditBalanceEntryViewModel model = new AddEditBalanceEntryViewModel();

            model.LoggedInUser = await userService.GetCurrentUser();

            model.FullNavList = CreateUserControllerAdminNavList();

            model.UserID = id;

            return(View(model));
        }
コード例 #2
0
        public async Task <ActionResult> EditBalanceEntry(int id)
        {
            AddEditBalanceEntryViewModel model = new AddEditBalanceEntryViewModel();

            model.BalanceEntry = userService.GetBalanceEntryByID(id);

            model.UserID = model.BalanceEntry.AppUser.Id;

            model.LoggedInUser = await userService.GetCurrentUser();

            model.FullNavList = CreateUserControllerAdminNavList();

            return(View(model));
        }
コード例 #3
0
        public async Task <ActionResult> EditBalanceEntry(AddEditBalanceEntryViewModel model)
        {
            model.LoggedInUser = await userService.GetCurrentUser();

            model.FullNavList = CreateUserControllerAdminNavList();

            if (ModelState.IsValid == false)
            {
                return(View(model));
            }

            await userService.EditBalanceEntry(model.BalanceEntry, model.ObjectiveID);

            return(RedirectToAction("AdminBalanceEntries"));
        }
コード例 #4
0
        public async Task <ActionResult> AddBalanceEntry(AddEditBalanceEntryViewModel model)
        {
            model.LoggedInUser = await userService.GetCurrentUser();

            model.FullNavList = CreateUserControllerAdminNavList();

            if (ModelState.IsValid == false)
            {
                return(View(model));
            }

            if (String.IsNullOrEmpty(model.UserID))
            {
                await userService.CreateBalanceEntry(model.BalanceEntry, model.ObjectiveID, model.UserNickName);
            }
            else
            {
                model.BalanceEntry.AppUser = await userService.GetUserByID(model.UserID);

                await userService.CreateBalanceEntry(model.BalanceEntry, model.ObjectiveID);
            }

            return(RedirectToAction("AdminBalanceEntries"));
        }