Exemple #1
0
        public async Task <IActionResult> Delete(int id)
        {
            ServiceResponse <List <GetDeliveryDto> > response = await _deliveryService.DeleteDelivery(id);

            if (response.Data == null)
            {
                return(NotFound(response));
            }

            return(Ok(response));
        }
 public ActionResult Delete(int deliveryId)
 {
     try
     {
         _deliveryService.DeleteDelivery(deliveryId);
         return(Json("ok"));
     }
     catch {
         return(Json("error"));
     }
 }
        public async Task <IActionResult> DeleteDelivery(int id)
        {
            var bDeliveryDeleted = await _deliveryService.DeleteDelivery(id);

            if (bDeliveryDeleted)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
Exemple #4
0
 public ActionResult Delete(int id)
 {
     try
     {
         var delivery = _deliveryService.GetDeliveryById(id);
         if (delivery == null)
         {
             return(RedirectToAction("List"));
         }
         _deliveryService.DeleteDelivery(id);
         SuccessNotification("Xóa phiếu xuất thành công");
         return(RedirectToAction("List"));
     }
     catch (Exception e)
     {
         ErrorNotification("Xóa phiếu xuất thất bại");
         return(RedirectToAction("List"));
     }
 }
Exemple #5
0
        public async Task <IActionResult> Delete([FromRoute] int id)
        {
            var delivery = await _deliveryService.SearchDelivery(id);

            // check out if exists and get object Entity
            if (delivery == null)
            {
                return(NotFound());
            }

            try
            {
                await _deliveryService.DeleteDelivery(delivery);
            }
            catch (DbUpdateException ex)
            {
                Console.WriteLine(ex);
                return(BadRequest());
            }

            return(Ok(delivery));
        }
Exemple #6
0
 public int Delete(int id)
 {
     return(_deliveryService.DeleteDelivery(id));
 }