コード例 #1
0
        /*
         * Removes an item from the favorites page
         */
        public IActionResult RemoveItem(_Items item)
        {
            FavoriteModel model = new FavoriteModel();

            model = (repository.Items.FirstOrDefault(i => i.ItemID == item.id && i.Username == HttpContext.User.Identity.Name));
            repository.DeleteFavorite(model);
            return(RedirectToAction("MyFavorites"));
        }
コード例 #2
0
        public async Task DeleteFavorite(string Id)
        {
            try
            {
                var favToDelete  = getFavorite(Id);
                var coordinateId = favToDelete.Coordinate_Id;

                await _categoryService.DeleteCategoriesOfFavorite(Id);

                _favRepo.DeleteFavorite(Id);
                _coordinateService.DeleteCoordinate(coordinateId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public IActionResult DeleteFavorite(Favorites favorite)
        {
            repo.DeleteFavorite(favorite);

            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public IActionResult Delete(int id)
 {
     _favoritesRepository.DeleteFavorite(id);
     return(Ok());
 }