public async Task <IActionResult> DeleteOrder(string line, int id) { var order = await warehouseRepository.GetOrder(id); if (order == null) { return(NotFound("Nie znaleziono.")); } var orders = await warehouseRepository.GetOrders(line); var orderPosition = order.Position; var positionToCheck = orders.Where(o => o.Position > orderPosition).Select(o => o.Position).ToList(); for (int i = 0; i < positionToCheck.Count(); i++) { var currentPosition = orders.Where(o => o.Position == positionToCheck[i]).FirstOrDefault(); currentPosition.Position -= 1; } warehouseRepository.Delete(order); if (await warehouseRepository.SaveAll()) { return(NoContent()); } return(BadRequest("Nie udało się usunąć zamówienia.")); }
public ActionResult DeleteConfirm(int id) { _warehouseRepository.Delete(id); return(RedirectToAction("GetAllWarehouses")); }
public void DeleteWarehouse(DeleteWarehouseInput input) { var warehouse = _WarehouseRepository.Get(input.Id); warehouse.IsDeleted = true; _WarehouseRepository.Delete(warehouse); }
public async Task <ActionResultResponse> Delete(string tenantId, string warehouseId) { var info = await _warehouseRepository.GetInfo(warehouseId); if (info == null) { return(new ActionResultResponse(-1, _warehouseResourceService.GetString("Warehouse does not exists."))); } if (info.TenantId != tenantId) { return(new ActionResultResponse(-2, _sharedResourceService.GetString(ErrorMessage.NotHavePermission))); } var isGoodsWarehouseExists = await _goodsReceiptNoteRepository.CheckExistWarehouseId(tenantId, warehouseId); if (isGoodsWarehouseExists) { return(new ActionResultResponse(-2, _warehouseResourceService.GetString("This warehouse has been used in the goods receipt note."))); } var result = await _warehouseRepository.Delete(warehouseId); return(new ActionResultResponse(result, _warehouseResourceService.GetString("Delete warehouse successful."))); }
public IActionResult Delete(int id) { var Warehouse = _repository.GetById(id); _repository.Delete(Warehouse); return(RedirectToAction("List")); }
public async Task <IActionResult> Delete(Guid id) { var item = await _warehouseRepository.GetById(id); await _warehouseRepository.Delete(item); return(Ok()); }
public ActionResult Delete(int?warehouseId) { if (warehouseId != null) { _warehouseRepository.Delete((int)warehouseId); } var viewModel = new WarehouseDemoViewModel(); viewModel.Warehouses = _warehouseRepository.List(); return(View("Index", viewModel)); }
public CommandResult Update(ProductUpdateCommand productUpdate, List <WarehouseCreateCommand> warehouseCommandList) { if (productUpdate.IsValid() == false) { return(CommandResult.Error(productUpdate.ValidationResult.ToString())); } if (_productRepository.Exists(productUpdate.Sku) == false) { return(CommandResult.Error("Sku do produto não existe.")); } foreach (var item in warehouseCommandList) { if (item.IsValid() == false) { return(CommandResult.Error(item.ValidationResult.ToString())); } } var product = new Product(sku: productUpdate.Sku, name: productUpdate.Name); var warehouseList = warehouseCommandList .Select(x => new Warehouse( sku: product.Sku, locality: x.Locality, quantity: x.Quantity, type: x.Type )); _productRepository.Update(product); _warehouseRepository.Delete(product.Sku); foreach (var warehouse in warehouseList) { _warehouseRepository.Create(warehouse); } return(CommandResult.Ok()); }
/// <summary> /// 删除 /// </summary> /// <param name="keyValue"></param> public void DeleteForm(string keyValue) { if (repository.IQueryable().Count(t => t.F_ParentId.Equals(keyValue)) > 0) { throw new Exception("删除失败!操作的对象包含了下级数据。"); } else if (!storagelocationApp.IsUsingForStorageLocation(keyValue)) { throw new Exception("删除失败!操作的对象已经有库位在使用中。"); } else { repository.Delete(t => t.F_Id == keyValue); } }
public async Task RollbackAsync(string tenantId) { var subscriptions = await _subscriptionRepository.GetAll().Where(x => x.TenantId == tenantId).ToListAsync(); _subscriptionRepository.Delete(subscriptions); await _subscriptionRepository.CommitAsync(); var companySettings = await _companySettingsRepository.GetAll().Where(x => x.TenantId == tenantId).ToListAsync(); _companySettingsRepository.Delete(companySettings); await _companySettingsRepository.CommitAsync(); var companies = await _companyRepository.GetAll().Where(x => x.TenantId == tenantId).ToListAsync(); _companyRepository.Delete(companies); await _companyRepository.CommitAsync(); var branches = await _branchRepository.GetAll().Where(x => x.TenantId == tenantId).ToListAsync(); _branchRepository.Delete(branches); await _branchRepository.CommitAsync(); var warehouses = await _warehouseRepository.GetAll().Where(x => x.TenantId == tenantId).ToListAsync(); _warehouseRepository.Delete(warehouses); await _warehouseRepository.CommitAsync(); #region Security var users = _userService.GetUsersByTenantId(tenantId); foreach (var user in users) { await _userService.DeleteUserAsync(user); } #endregion var tenants = await _tenantRepository.GetAll().Where(x => x.Id == tenantId).ToListAsync(); _tenantRepository.Delete(tenants); await _tenantRepository.CommitAsync(); }
public ActionResult <Warehouse> Delete(Guid id) { try { var result = warehouseRepo.Retrieve() .FirstOrDefault((ctg) => ctg.WarehouseID == id); if (result == null) { return(NotFound()); } warehouseRepo.Delete(id); return(NoContent()); } catch (Exception) { return(BadRequest()); } }
public IActionResult BulkDelete(string ids) { try { var arrayIds = ids.Split(","); if (arrayIds.Length == 0) { return new ResponseResult(Response) { StatusCode = (int)StatusCodes.Status400BadRequest, ErrorMessage = "Deleting failed. No record was selected" } } .ToJsonResult(); _repository.Delete(arrayIds); return(Ok($"Successfully Deleted {arrayIds.Length} records.")); }
public int DelWarehouse(string ids) { int i = _warehouseRepository.Delete(ids); return(i); }
public Warehouse Delete(int id) { return(_warehouseRepository.Delete(id)); }
public JsonResult DeleteRepository(int id) { return(Json <string>(_warehouseRepository.Delete(id), "删除成功!")); }
public ApiResponseBase Delete(int id) { _repo.Delete(id); return(new ApiResponseBase()); }