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)));
        }
示例#3
0
        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();
            }
        }
示例#4
0
        // 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);
        }
示例#5
0
 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"));
 }
示例#6
0
 // DELETE: api/Batchs/5
 public void Delete(int id)
 {
     _batchService.Delete(id);
 }