public HttpResponseMessage DeleteBatch(int batchId) { //var _batch = _batchService.GetBatchById(batchViewModel.BatchId); //var batch = _batchService.GetBatchById(batchId); _batchService.Delete(batchId); _batchService.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task <IActionResult> Delete(Batch batch) { if (batch == null) { return(RedirectToAction(nameof(Error))); } await _service.Delete(batch); return(RedirectToAction(nameof(Index))); }
private void buttonDeleteBatch_Click(object sender, RoutedEventArgs e) { object item = dataGridBatch.SelectedItem; if (item == null) { MessageBox.Show("Please choice data want to delete!"); } else { _batchService.Delete(Convert.ToInt16(textBlockIdBatch.Text)); LoadGridBatch(); } }
// DELETE: api/Batches/5 public HttpResponseMessage DeleteBatch(int id) { var message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request"); if (string.IsNullOrWhiteSpace(id.ToString())) { message = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Invalid Id"); } else { var result = _iBatchService.Delete(id); if (result) { message = Request.CreateResponse(HttpStatusCode.OK); } } return(message); }
public ActionResult Delete(BatchViewModel viewModel) { if (ModelState.IsValid) { var result = _batchService.Delete(viewModel.BatchId); if (result.Success) { Success(result.Results.FirstOrDefault().Message); ModelState.Clear(); } else { _logger.Warn(result.Results.FirstOrDefault().Message); Warning(result.Results.FirstOrDefault().Message, true); } } return(RedirectToAction("Index")); }
// DELETE: api/Batchs/5 public void Delete(int id) { _batchService.Delete(id); }