public Result <int> Delete(Guid ID) { var attachment = _attachmentService.List(ID); _tagsService.Delete(ID); if (attachment.Data.Count > 0) { foreach (var item in attachment.Data) { string path = $"{Enum.GetName(typeof(PathType), item.PathType)}/{item.FileName}"; _attachmentService.Delete(item.ID); FileHelper.DeleteFile(path); } } return(_dataSource.Delete(ID)); }
public async Task <IActionResult> DeleteAsync([FromRoute] int id) { var comment = await _tagsService.FindAsync(id); if (comment == null) { return(NotFound()); } _tagsService.Delete(comment); var response = new CreatedResponse <int> { Id = id }; return(Ok(response)); }
public Result <Article> Edit(Article model) { if (model.Tags.Count > 0) { var tags = new List <Tags>(); foreach (var item in model.Tags) { tags.Add(new Tags { Name = item }); } _tagsService.Insert(tags, model.ID); } else { _tagsService.Delete(model.ID); } model.ReadingTime = CalculateReadingTime.MinReadTime(model.Body); return(_dataSource.Update(model)); }
public async Task <OperationResult> DeleteTag(int tagId) { return(await _tagsService.Delete(tagId)); }
public void Delete(int id) { var result = _tagService.Delete(id); Assert.IsTrue(result.Success); }
public void DeleteTag([FromRoute] string label) { _service.Delete(label); }
public async Task <IActionResult> Delete(int id) { await _tagsService.Delete(id); return(NoContent()); }