public async Task <IActionResult> GetFormDesignerData(string searchInput, string sidx, string sord, int page = 1, int rows = 10) { var jsonData = new { total = 0, page, records = 0, rows = new List <PermitFormScreenDesignTemplateModel>() }; try { IEnumerable <PermitFormScreenDesignTemplateBE> listPermitFormScreenDesignTemplate = FormLogic.BlockFetchPermitFormScreenDesignTemplate(page, rows, out int totalRecords, searchInput); if (listPermitFormScreenDesignTemplate == null) { return(Json(jsonData)); } else { var resultFormTemplate = (from permitFormScreenDesignTemplateObj in listPermitFormScreenDesignTemplate select new PermitFormScreenDesignTemplateModel { FormID = permitFormScreenDesignTemplateObj.FormID.ToString(), Design = permitFormScreenDesignTemplateObj.Design, Description = permitFormScreenDesignTemplateObj.Description, Active = permitFormScreenDesignTemplateObj.Active.ToString(), CreatedDateTime = permitFormScreenDesignTemplateObj.CreatedDateTime.ToString(), LastUpdatedDateTime = permitFormScreenDesignTemplateObj.LastUpdatedDateTime.ToString(), CreatedBy = permitFormScreenDesignTemplateObj.CreatedBy, UpdatedBy = permitFormScreenDesignTemplateObj.UpdatedBy }).ToList(); var totalPages = (int)Math.Ceiling((float)totalRecords / (float)rows); jsonData = new { total = totalPages, page, records = totalRecords, rows = resultFormTemplate }; } var jsonResult = Json(jsonData); return(jsonResult); } catch (Exception ex) { return(Json(jsonData)); } }
public IEnumerable <SelectListItem> GetForms() { IEnumerable <PermitFormScreenDesignTemplateBE> listPermitFormScreenDesignTemplate = FormLogic.BlockFetchPermitFormScreenDesignTemplate(1, Int32.MaxValue, out int totalRecords, ""); List <SelectListItem> forms = new List <SelectListItem>(); forms = listPermitFormScreenDesignTemplate.Select(m => new SelectListItem() { Text = m.Design, Value = m.FormID.ToString() }).ToList(); forms.Insert(0, new SelectListItem { Text = "--Select Form--", Value = "-1" }); return(forms); }