public ActionResult _DeletePrePO(Int32 PrePurcherseOrderId, Int32?FatherId) { var model = new _DeletePrePOViewModel(); model.Fill(CargarDatosContext(), PrePurcherseOrderId, FatherId); return(View(model)); }
public ActionResult _DeletePrePO(_DeletePrePOViewModel model) { try { PrePurcherseOrder prePurcherseOrder = null; if (model.PrePurcherseOrderId > 0) { prePurcherseOrder = context.PrePurcherseOrder.FirstOrDefault(x => x.PrePurcherseOrderId == model.PrePurcherseOrderId); prePurcherseOrder.State = ConstantHelpers.ESTADO.INACTIVO; } context.SaveChanges(); PostMessage(MessageType.Success); } catch (Exception ex) { PostMessage(MessageType.Error); } return(RedirectToAction("ListPrePO", new { FatherId = model.FatherId })); }