示例#1
0
        public IHttpActionResult GetMasterDirectionIndexAmendment([FromUri] GetMasterDirectionIndexAmendmentRequest getMasterDirectionIndexAmendmentRequest)
        {
            var responses = new Responses();

            try
            {
                if (Utility.UserId < 0)
                {
                    return(BadRequest(Utility.INVALID_USER));
                }

                if (getMasterDirectionIndexAmendmentRequest == null)
                {
                    getMasterDirectionIndexAmendmentRequest = new GetMasterDirectionIndexAmendmentRequest();
                }

                if (getMasterDirectionIndexAmendmentRequest.PageSize == null)
                {
                    getMasterDirectionIndexAmendmentRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);
                }

                var masterDirectionIndexAmendment = new MasterDirectionIndexAmendment()
                {
                    MasterDirectionIndexAmendmentId = getMasterDirectionIndexAmendmentRequest.MasterDirectionIndexAmendmentId,
                    MasterDirectionId = getMasterDirectionIndexAmendmentRequest.MasterDirectionId,
                    SearchText        = getMasterDirectionIndexAmendmentRequest.SearchText,
                    IsActive          = getMasterDirectionIndexAmendmentRequest.IsActive,
                    PageNumber        = getMasterDirectionIndexAmendmentRequest.PageNumber,
                    PageSize          = Convert.ToInt32(getMasterDirectionIndexAmendmentRequest.PageSize),
                    IsPagingRequired  = (getMasterDirectionIndexAmendmentRequest.PageNumber != null) ? true : false,
                    OrderBy           = getMasterDirectionIndexAmendmentRequest.OrderBy,
                    OrderByDirection  = getMasterDirectionIndexAmendmentRequest.OrderByDirection
                };
                var masterDirectionIndexAmendments = iMasterDirectionIndexAmendment.GetMasterDirectionIndexAmendment(masterDirectionIndexAmendment);

                var masterDirectionIndexAmendmentList = new List <GetMasterDirectionIndexAmendmentResponse>();
                foreach (var masterDirectionIndexAmendmentDetail in masterDirectionIndexAmendments)
                {
                    masterDirectionIndexAmendmentList.Add(new GetMasterDirectionIndexAmendmentResponse()
                    {
                        MasterDirectionIndexAmendmentId = masterDirectionIndexAmendmentDetail.MasterDirectionIndexAmendmentId,
                        MasterDirectionId        = masterDirectionIndexAmendmentDetail.MasterDirectionId,
                        APDIRCircularIds         = masterDirectionIndexAmendmentDetail.APDIRCircularIds,
                        APDIRCirculars           = masterDirectionIndexAmendmentDetail.APDIRCirculars,
                        NotificationIds          = masterDirectionIndexAmendmentDetail.NotificationIds,
                        Notifications            = masterDirectionIndexAmendmentDetail.Notifications,
                        MasterDirectionChapterId = masterDirectionIndexAmendmentDetail.MasterDirectionChapterId,
                        Chapter = masterDirectionIndexAmendmentDetail.Chapter,
                        MasterDirectionIndexId = masterDirectionIndexAmendmentDetail.MasterDirectionIndexId,
                        IndexNo   = masterDirectionIndexAmendmentDetail.IndexNo,
                        IndexName = masterDirectionIndexAmendmentDetail.IndexName,
                        MasterDirectionSubIndexId = masterDirectionIndexAmendmentDetail.MasterDirectionSubIndexId,
                        SubIndexNo            = masterDirectionIndexAmendmentDetail.SubIndexNo,
                        SubIndexName          = masterDirectionIndexAmendmentDetail.SubIndexName,
                        IndexAmendmentContent = masterDirectionIndexAmendmentDetail.IndexAmendmentContent,
                        Year = masterDirectionIndexAmendmentDetail.Year,
                        UpdatedInsertedByRBI     = masterDirectionIndexAmendmentDetail.UpdatedInsertedByRBI,
                        UpdatedInsertedDateByRBI = masterDirectionIndexAmendmentDetail.UpdatedInsertedDateByRBI,
                        IsActive       = Convert.ToBoolean(masterDirectionIndexAmendmentDetail.IsActive),
                        CreatedBy      = masterDirectionIndexAmendmentDetail.CreatedBy,
                        TotalPageCount = masterDirectionIndexAmendmentDetail.TotalPageCount,
                        TotalRecord    = masterDirectionIndexAmendmentDetail.TotalRecord
                    });
                }

                responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                responses.Description = "MasterDirectionIndexAmendment retrieved successfully";
                responses.Response    = masterDirectionIndexAmendmentList;
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while retrieving MasterDirectionIndexAmendment.";

                Utility.WriteLog("GetMasterDirectionIndexAmendment", getMasterDirectionIndexAmendmentRequest, "Error while retrieving MasterDirectionIndexAmendment. (MasterDirectionIndexAmendmentAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }