0

i have a delete action methode that i want to add a validationerror in the catch :i want to delet an attribute called NOM from a table T_CONSTANTE that another table Y contains in her field called FORMULE that attribute my methode

public ActionResult Delete([DataSourceRequest] DataSourceRequest dsRequest, ConstanteVM vm)
    {

        try
        {
            ViewData["ConstanteType"] = new SelectList(RefDataManager.GetRefData<ConstanteTypeVM>(), "ConstanteTypeCode", "ConstanteTypeLibelle");

            if (ModelState.IsValid)
            {
                ConstanteVM assur = ServiceApplicatif.Delete(vm.ConstanteId);

            }
            DataCache dataCache = new DataCache(CurrentSecurityContext.TenantID);
            dataCache.DropDataCache<ConstanteVM>();



            return Json(new[] { vm }.ToDataSourceResult(dsRequest, ModelState));
        }

        catch (Exception e2)
        {

             var predicate = PredicateBuilder.False<T_CONSTANTE>();
           if (?????? ))
            {
                ModelState.AddModelError("NOM", "exist dans Y");

            }
            return Json(ModelState.ToDataSourceResult());
           {}

` i must use the linqkit to continue the if() but i didn't understand how to use it

ODE
  • 285
  • 5
  • 22

0 Answers0