public IEnumerable <MasterDirectionOfFEMASubModuleDetail> GetMasterDirectionOfFEMASubModuleDetail(MasterDirectionOfFEMASubModuleDetail masterDirectionOfFEMASubModuleDetail) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter totalPageCount = new ObjectParameter("TotalPageCount", typeof(int)); ObjectParameter totalRecord = new ObjectParameter("TotalRecord", typeof(int)); var masterDirectionOfFEMASubModuleDetails = dataContext.MasterDirectionOfFEMASubModuleDetailGet(masterDirectionOfFEMASubModuleDetail.FEMASubModuleOfModuleId, Utility.TrimString(masterDirectionOfFEMASubModuleDetail.SearchText), masterDirectionOfFEMASubModuleDetail.IsActive, masterDirectionOfFEMASubModuleDetail.PageNumber, masterDirectionOfFEMASubModuleDetail.PageSize, masterDirectionOfFEMASubModuleDetail.IsPagingRequired, Utility.TrimString(masterDirectionOfFEMASubModuleDetail.OrderBy), Utility.TrimString(masterDirectionOfFEMASubModuleDetail.OrderByDirection), totalPageCount, totalRecord).ToList(); var masterDirectionOfFEMASubModuleDetailList = new List <MasterDirectionOfFEMASubModuleDetail>(); foreach (var masterDirectionOfFEMASubModuleDetailItem in masterDirectionOfFEMASubModuleDetails) { masterDirectionOfFEMASubModuleDetailList.Add(new MasterDirectionOfFEMASubModuleDetail() { MasterDirectionId = masterDirectionOfFEMASubModuleDetailItem.MDID, MasterDirectionName = masterDirectionOfFEMASubModuleDetailItem.MasterDIrectionName, Year = masterDirectionOfFEMASubModuleDetailItem.Year, PDF = masterDirectionOfFEMASubModuleDetailItem.PDF, IsActive = masterDirectionOfFEMASubModuleDetailItem.IsActive, TotalPageCount = Convert.ToInt32(totalPageCount.Value), TotalRecord = Convert.ToInt32(totalRecord.Value) }); } return(masterDirectionOfFEMASubModuleDetailList); } }
public IHttpActionResult GetMasterDirectionOfFEMASubModuleDetail([FromUri] GetMasterDirectionOfFEMASubModuleDetailRequest getMasterDirectionOfFEMASubModuleDetailRequest) { var responses = new Responses(); try { if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } if (getMasterDirectionOfFEMASubModuleDetailRequest == null) { getMasterDirectionOfFEMASubModuleDetailRequest = new GetMasterDirectionOfFEMASubModuleDetailRequest(); } if (getMasterDirectionOfFEMASubModuleDetailRequest.PageSize == null) { getMasterDirectionOfFEMASubModuleDetailRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); } var masterDirectionOfFEMASubModuleDetail = new MasterDirectionOfFEMASubModuleDetail() { FEMASubModuleOfModuleId = getMasterDirectionOfFEMASubModuleDetailRequest.FEMASubModuleOfModuleId, SearchText = getMasterDirectionOfFEMASubModuleDetailRequest.SearchText, IsActive = getMasterDirectionOfFEMASubModuleDetailRequest.IsActive, PageNumber = getMasterDirectionOfFEMASubModuleDetailRequest.PageNumber, PageSize = Convert.ToInt32(getMasterDirectionOfFEMASubModuleDetailRequest.PageSize), IsPagingRequired = (getMasterDirectionOfFEMASubModuleDetailRequest.PageNumber != null) ? true : false, OrderBy = getMasterDirectionOfFEMASubModuleDetailRequest.OrderBy, OrderByDirection = getMasterDirectionOfFEMASubModuleDetailRequest.OrderByDirection }; var masterDirectionOfFEMASubModuleDetails = iFEMASubModuleDetail.GetMasterDirectionOfFEMASubModuleDetail(masterDirectionOfFEMASubModuleDetail); var masterDirectionOfFEMASubModuleDetailList = new List <GetMasterDirectionOfFEMASubModuleDetailResponse>(); foreach (var masterDirectionOfFEMASubModuleDetailItem in masterDirectionOfFEMASubModuleDetails) { masterDirectionOfFEMASubModuleDetailList.Add(new GetMasterDirectionOfFEMASubModuleDetailResponse() { MasterDirectionId = masterDirectionOfFEMASubModuleDetailItem.MasterDirectionId, MasterDirectionName = masterDirectionOfFEMASubModuleDetailItem.MasterDirectionName, Year = masterDirectionOfFEMASubModuleDetailItem.Year, PDF = masterDirectionOfFEMASubModuleDetailItem.PDF, IsActive = Convert.ToBoolean(masterDirectionOfFEMASubModuleDetailItem.IsActive), CreatedBy = masterDirectionOfFEMASubModuleDetailItem.CreatedBy, TotalPageCount = masterDirectionOfFEMASubModuleDetailItem.TotalPageCount, TotalRecord = masterDirectionOfFEMASubModuleDetailItem.TotalRecord }); } responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "MasterDirectionOfFEMASubModuleDetail retrieved successfully"; responses.Response = masterDirectionOfFEMASubModuleDetailList; } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while retrieving MasterDirectionOfFEMASubModuleDetail."; Utility.WriteLog("GetMasterDirectionOfFEMASubModuleDetail", getMasterDirectionOfFEMASubModuleDetailRequest, "Error while retrieving MasterDirectionOfFEMASubModuleDetail. (MasterDirectionOfFEMASubModuleDetailUserController)", ex.ToString()); } return(Ok(responses)); }