public ActionResult Delete(string Id) { if (_warehouseService.DeleteWarehouse(Id)) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK)); } return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); }
private void tsbtnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("确认删除吗?", "删除提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { var warehouse = this.dataGridViewX1.CurrentRow.DataBoundItem as Warehouse; WarehouseService.DeleteWarehouse(warehouse.Id); LoadData(); } }
// DELETE: odata/Warehouse(5) public IHttpActionResult Delete(Guid key) { // TODO: Add delete logic here. using (var unitOfWork = _unitOfWorkManager.NewUnitOfWork()) { _warehouse.DeleteWarehouse(key); unitOfWork.Commit(); } return(StatusCode(HttpStatusCode.OK)); //return StatusCode(HttpStatusCode.NotImplemented); }
public async Task <ActionResult> DeleteWarehouse(Guid id) { var username = User.Claims.FirstOrDefault(x => x.Type == "FullName").Value; if (await DB.CatalogDB.AnyAsync(x => x.WarehouseId == id)) { return(BadRequest(new { message = "Noliktava vēl ir produkti." })); } // Calling method that will delete warehouse from DB await WarehouseService.DeleteWarehouse(id, username); // Returning filtered warehouse list return(Ok()); }
protected void lnbDelete_Click(object sender, EventArgs e) { try { int[] id = WebFormHelper.GetRowIdForDeletion(gvwMaster); Array.ForEach(id, wh => WarehouseService.DeleteWarehouse(wh)); ReloadCurrentPage(); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass( lblMessage, ex.Message, LabelStyleNames.ErrorMessage); LogService.ErrorException(GetType().FullName, ex); } }