public async Task <JsonResult> Delete([FromBody] CategoryDeleteDto categoryDeleteDto) { if (categoryDeleteDto == null) { return(Json(new JResult { Status = Status.BadRequest, Message = "Silinmek istenen kategori bulunamadı!" })); } if (!await _categoryService.CategoryExistsAsync(categoryDeleteDto.Id)) { return(Json(new JResult { Status = Status.NotFound, Message = "Silinmek istenen kategori bulunamadı!" })); } var category = await _categoryService.FindByIdAsync(categoryDeleteDto.Id); category.IsDelete = false; await _categoryService.UpdateAsync(category); return(Json(new JResult { Status = Status.Ok, Message = "Kategori başarıyla silindi." })); }
public IActionResult Delete([FromBody] CategoryDeleteDto categoryDeleteDto) { CategoryDeleteCommand categoryDeleteCommand = MapService.Map(categoryDeleteDto); Result result = _messages.Dispatch(categoryDeleteCommand); return(FromResult(result)); }
public async Task <IActionResult> DeleteCategory(Guid id) { var model = new CategoryDeleteDto() { Id = id }; await _categoryService.DeleteAsync(model); return(NoContent()); }
public async Task <ApiResult> DeleteCategory(CategoryDeleteDto input) { var goodsCategory = await repository.GetAsync(input.Id); if (goodsCategory == null) { throw new ApplicationServiceException("没有找到该商品分类!"); } repository.Delete(goodsCategory); if (await new CheckGoodsCategoryCanRemoveSpecification(goodsRepository).IsSatisfiedBy(goodsCategory)) { await unitofWork.CommitAsync(); } return(ApiResult.Ok("商品分类删除成功")); }
public async Task DeleteAsync(CategoryDeleteDto dto) { if (dto.Id == Guid.Empty) { throw new ArticleException(ArticleErrorCodes.CategoryIdCannotBeNull, "Category Id field is mandatory.", dto); } var entity = await _categoryRepository.GetByIdAsync(dto.Id); if (entity == null) { throw new ArticleException(ArticleErrorCodes.CategoryCouldNotBeFound, "Category could not be found.", dto); } await _categoryRepository.DeleteAsync(entity); }
public async Task <bool> DeleteAsync(CategoryDeleteDto model) { using (var tran = databaseFixture.Db.BeginTransaction()) { try { var dbmodel = await databaseFixture.Db.WorkflowCategory.GetCategoriesAsync(model.Ids); foreach (var item in dbmodel) { item.Status = 0; } await databaseFixture.Db.WorkflowCategory.BulkUpdateAsync(dbmodel, tran); tran.Commit(); return(true); } catch (Exception ex) { tran.Rollback(); return(false); } } }
public async Task <bool> DeleteAsync([FromBody] CategoryDeleteDto model) { model.UserId = UserIdentity.UserId.ToString(); return(await categoryService.DeleteAsync(model)); }
public async Task <bool> DeleteAsync([FromBody] CategoryDeleteDto model) { return(await categoryService.DeleteAsync(model)); }
public async Task <bool> DeleteAsync(CategoryDeleteDto model) { var uri = API.Category.DeleteAsync(_baseUrl); return(await _apiClient.PostBooleanAsync(uri, model)); }