Exemple #1
0
        public IHttpActionResult GetMyMarketJobs(DateTime reqDate, string serialNo, int userId)
        {
            serialNo = serialNo.Trim().ToLower();

            var terminal = TerminalServices.GetTerminalBySerial(serialNo);

            if (terminal == null)
            {
                return(Unauthorized());
            }

            reqDate = TerminalServices.GetTerminalSyncDate(reqDate, terminal.TenantId);

            var jobs   = _marketServices.GetAllResourceJobs(userId, reqDate, true);
            var result = new MarketJobsSyncCollection {
                Jobs = jobs.Select(m => AutoMapper.Mapper.Map <MarketJobAllocationModel, MyJobSync>(m)).ToList(), Count = jobs.Count
            };

            result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, jobs.Count, terminal.TerminalId, TerminalLogTypeEnum.MarketJobSync).TerminalLogId;

            return(Ok(result));
        }