public ActionResult Delete(string[] ids) { try { if (ids.IsAny()) { var idTest = from id in ids select id; var aa = idTest.FirstOrDefault(); var genericControls = from id in ids select _gCService.GetById(int.Parse(id)); _gCService.BatchDelete(genericControls); //Delete localize for (var i = 0; i < ids.Length; i++) { var localizedProperties = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(localizedProperties); } } } catch (Exception ex) { LogText.Log(string.Concat("GenericControl --> Delete: ", ex.Message)); ModelState.AddModelError("", ex.Message); } return(RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { var genericControls = from id in ids select _genericControlService.GetById(int.Parse(id)); _genericControlService.BatchDelete(genericControls); //Delete localize for (var i = 0; i < ids.Length; i++) { var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("ServerGenericControl.Delete: ", exception.Message)); } return(RedirectToAction("Index")); }