コード例 #1
0
        public ActionResult <ItemResponse <SeekerDashboard> > GetById(int id)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                SeekerDashboard seeker = _service.GetById(id);

                if (seeker == null)
                {
                    code     = 404;
                    response = new ErrorResponse("Application resource not found");
                }
                else
                {
                    response = new ItemResponse <SeekerDashboard> {
                        Item = seeker
                    };
                }
            }
            catch (ArgumentException argEx)
            {
                code     = 500;
                response = new ErrorResponse($"ArgumentException Error: {argEx.Message}");
            }
            return(StatusCode(code, response));
        }
コード例 #2
0
        public SeekerDashboard GetById(int id)
        {
            SeekerDashboard seekerDashboard = null;
            string          procName        = "[dbo].[SeekerDashboard_CountByUserId]";

            _SeekerDashboardService.ExecuteCmd(procName, inputParamMapper : delegate(SqlParameterCollection col)
            {
                col.AddWithValue("@UserId", id);
            }, singleRecordMapper : delegate(IDataReader reader, short set)
            {
                seekerDashboard = new SeekerDashboard();
                int index       = 0;

                seekerDashboard.JobsAppliedForCount = reader.GetSafeInt32(index++);
                seekerDashboard.TotalJobsCount      = reader.GetSafeInt32(index++);
                seekerDashboard.EventCount          = reader.GetSafeInt32(index++);
                seekerDashboard.OrgFollowedCount    = reader.GetSafeInt32(index++);
            });
            return(seekerDashboard);
        }