public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var partner = _partnerQueryService.Find(request.Id); if (partner == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该用户" }); } //删除 var command = new DeletePartnerCommand { AggregateRootId = request.Id }; var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "删除代理", request.Id, partner.Region); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //分类判断 var category = _categoryQueryService.Find(request.Id); if (category == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该分类" }); } //判断是否有子分类 var children = _categoryQueryService.GetChildren(request.Id); if (children.Any()) { return(new BaseApiResponse { Code = 400, Message = "包含子分类,无法删除" }); } //删除 var command = new DeleteCategoryCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete([FromBody] DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var goodsBlock = _goodsBlockQueryService.Find(request.Id); if (goodsBlock == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该项目" }); } //删除 var command = new DeleteGoodsBlockCommand { AggregateRootId = request.Id }; var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var offlineStore = _offlineStoreQueryService.Info(request.Id); if (offlineStore == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该店铺" }); } //删除 var command = new DeleteOfflineStoreCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "删除线下店铺", request.Id, offlineStore.Name); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var announcement = _announcementQueryService.Find(request.Id); if (announcement == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该公告" }); } //删除 var command = new DeleteAnnouncementCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "删除公告", request.Id, announcement.Title); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> DeleteBankCard(DeleteRequest request) { request.CheckNotNull(nameof(request)); var currentAccount = _contextService.GetCurrentAccount(HttpContext); var command = new RemoveBankCardCommand(currentAccount.WalletId.ToGuid(), request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //分类判断 var category = _categoryQueryService.Find(request.Id); if (category == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该分类" }); } //判断是否有子分类 var children = _categoryQueryService.GetChildren(request.Id); if (children.Any()) { return(new BaseApiResponse { Code = 400, Message = "包含子分类,无法删除" }); } //删除 var command = new DeleteCategoryCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "删除分类", request.Id, category.Name); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete([FromBody] DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var offlineStore = _offlineStoreQueryService.Info(request.Id); if (offlineStore == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该店铺" }); } //删除 var command = new DeleteOfflineStoreCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var goods = _goodsQueryService.GetGoodsAlias(request.Id); if (goods == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该商品" }); } //删除 var command = new DeleteGoodsCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "删除失败{0},可能商品存在预定,无法删除".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var announcement = _announcementQueryService.Find(request.Id); if (announcement == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该公告" }); } //删除 var command = new DeleteAnnouncementCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Delete(DeleteRequest request) { request.CheckNotNull(nameof(request)); //判断 var order = _storeOrderQueryService.Find(request.Id); if (order == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该订单" }); } //删除 var command = new DeleteStoreOrderCommand(request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "删除失败{0},可能订单状态不允许删除".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }