/* * 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")); }
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; } }
public IActionResult DeleteFavorite(Favorites favorite) { repo.DeleteFavorite(favorite); return(RedirectToAction("Index")); }
public IActionResult Delete(int id) { _favoritesRepository.DeleteFavorite(id); return(Ok()); }