Denmark Puso

Denmark Puso

  • 1.7k
  • 142
  • 2.8k

RedirectToAction not working?

Sep 18 2019 9:03 PM
i have child called "shipmentitemlist" and parent named "shipmentlist".
 
in my child table  when i delete 1 row i need to redirect again in shipmenitemlist. the problem is didnot redirect to my child table.
 
this is my code..
 
  1. public ActionResult Delete(int id, ShipmentItemFormModel model)  
  2.         {  
  3.             var ShipmentId = _shipmentService.GetAll();  
  4.   
  5.             if (model.Id > 0)  
  6.             {  
  7.                 try  
  8.                 {  
  9.                     var shipmentItem = _shipmentItemService.Get(model.Id);  
  10.                     _shipmentItemService.Remove(shipmentItem);  
  11.                     return RedirectToAction("shipmentitemlist""shipmentlist"new { id = ShipmentId });  
  12.                 }  
  13.                 catch (Exception ex)  
  14.                 {  
  15.                     ModelState.AddModelError("CustomError", ex.Message);  
  16.                     return View(PrepareShipmentItemModel(model));  
  17.                 }  
  18.             }  
  19.             return View(model);  
  20.         }     
 

Answers (8)