public IActionResult DeleteOrder(int id) { var rowsDeleted = _oa.DeleteOrder(id); return(rowsDeleted >= 1 ? Ok(new { rowsDeleted }) : BadRequest(new { rowsDeleted }) as IActionResult); }
public void TestIfDeleteOrderCallsDeleteOrderInRepo() { // Arrange var repo = new Mock <IOrderRepository>(); var manager = new OrderAccess(repo.Object); // Act manager.DeleteOrder(It.IsAny <int>()); // Assert repo.Verify(x => x.DeleteOrder(It.IsAny <int>()), Times.Exactly(1)); }
private void lbCancleTicket_Click(object sender, EventArgs e) { if (indexer != -1) { DialogResult dr = MessageBox.Show("确定删除景点ID为" + ORId + "订单吗?", "确定", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { bool isSuccess = OrderAccess.DeleteOrder(DTId); if (isSuccess) { MessageBox.Show("景点删除成功"); } DataSet ds = OrderAccess.ShowOrderForDistributor(DTId); if (ds != null) { dataGridView2.DataSource = ds.Tables[0]; this.Refresh(); } } } }
private void label3_Click(object sender, EventArgs e) { if (indexer != -1) { DialogResult dr = MessageBox.Show("确定删除?", "确定", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { dataGridView1.DataSource = dTable; bool isSuccess = OrderAccess.DeleteOrder(TKId); if (isSuccess) { MessageBox.Show("订单删除成功"); } DataSet ds = OrderAccess.ShowOrder(UserID); dataGridView1.DataSource = ds.Tables[0]; if (ds != null) { this.Refresh(); } } } }