public void deleteProductTag(int id) { ProductTag ProductTag = ProductTagRepository.GetById(id); ProductTagRepository.Delete(ProductTag); SaveChange(); }
public async Task <bool> RemoveTag(int tagId, int productId) { var tag = await _repository.GetById(tagId, productId); if (tag == null) { return(false); } var removed = await _repository.Delete(tag); return(removed); }
public void DeleteProductTag(string productId, string tagId) { try { string id = _productTagRepository.All.Where(w => w.TagId == tagId && w.ProductId == productId).Select(s => s.Id).FirstOrDefault(); ProductTag productTag = _productTagRepository.Get(id); _productTagRepository.Delete(productTag); _productTagRepository.Save(requestContext); } catch (Exception) { } }
public bool Delete(string id) { try { Tag tag = _tagRepository.Get(id); var productTagList = _productTagRepository.GetProductTagViewModelsByTagId(id).Select(s => s.Id).ToList(); if (productTagList.Count > 0) { foreach (var item in productTagList) { _productTagRepository.Delete(item); } } _productTagRepository.Save(RequestContext); _tagRepository.Delete(tag); _tagRepository.Save(RequestContext); return(true); } catch (Exception) { return(false); } }
public ProductTag Delete(int id) { return(_productTagRepository.Delete(id)); }
public void Delete(int id) { _productTagRepository.Delete(id); }