示例#1
0
        public async Task <bool> Add(MVCFavoriteAdd Favorite)
        {
            string usp = "usp_MVCFavoriteAdd @UserID, @Controller, @Action, @RouteId, @Name, @Sequence, @MVCFavoriteGroupId";

            _sqlDataAccess.SaveData <MVCFavoriteAdd>(usp, Favorite);
            return(true);
        }
        public async Task <IActionResult> Add(MVCFavoriteAdd Favorite)
        {
            if (Favorite.MVCFavoriteGroupId == 0)
            {
                Favorite.MVCFavoriteGroupId = null;
            }
            var CurrentUser = await _userManager.GetUserAsync(User);

            Favorite.UserId = CurrentUser.Id;
            await _favoriteProvider.Add(Favorite);

            return(Ok(Favorite));
        }
示例#3
0
        public async Task <IActionResult> Add(MVCFavoriteAdd Favorite)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)

            {
                return(RedirectToAction("Login", "FrontAuth"));
            }

            Favorite = await _client.PostProtectedAsync <MVCFavoriteAdd>($"{_configuration["APIUrl"]}api/MVCFavorite/Add", Favorite, token);

            //if (ClassificationCreateGetWithErrorMessage.ErrorMessages.Count>0)
            //{
//                var UITerms = await _client.GetProtectedAsync<List<FavoritesAdd>>($"{_configuration["APIUrl"]}api/MVC/Favorite/Add", token);
            //
            //ViewBag.ErrorMessages = ClassificationCreateGetWithErrorMessage.ErrorMessages;
            //return View(ClassificationCreateGetWithErrorMessage.Classification);
            return(Ok(Favorite));
        }