public JsonResult AddOrUpdateEntity(TBL_VENDOR item, bool isEdit) { if (!string.IsNullOrWhiteSpace(item.VendorName) && ((isEdit && item.VendorID > 0) || !isEdit)) { try { int result = isEdit ? DA_Vendor.Instance.Update(item) : DA_Vendor.Instance.Insert(item); return(Json(result > 0 ? 1 : 0)); } catch (Exception ex) { } } return(Json(0)); }
public JsonResult delete() { try { //jQuery DataTables Param string id = (Request.Form.GetValues("id").FirstOrDefault() == null ? "" : Request.Form.GetValues("id").FirstOrDefault().ToString()); if (id.All(Char.IsDigit)) { TBL_VENDOR vendor = DA_Vendor.Instance.GetById(Convert.ToInt32(id)); return(Json(vendor == null ? 0 : DA_Vendor.Instance.Delete(vendor))); } return(Json(0)); } catch (Exception ex) { return(Json(0)); } }