예제 #1
0
        //[ResponseType(typeof(bool))]
        public IHttpActionResult TISDataCapture(IList <TISDataModel> models)
        {
            using (var dbContext = new DataContext())
            {
                var tisRepository = new TISRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!tisRepository.CaptureTIS(models))
                {
                    return(this.BadRequest(Error.PopulateMethodFailed(tisRepository.Error)));
                }

                return(Ok());
            }
        }
예제 #2
0
        public IHttpActionResult LockCapture(string referenceNumber, string vehicleRegistration)
        {
            bool isSuccessful;

            using (var dbContext = new DataContext())
            {
                var tisRepository = new TISRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!tisRepository.CaptureLock(referenceNumber, vehicleRegistration, out isSuccessful))
                {
                    return(this.BadRequest(Error.PopulateMethodFailed(tisRepository.Error)));
                }

                return(Ok(isSuccessful));
            }
        }
예제 #3
0
        public IHttpActionResult Exports(long numberToExport, long districtID)
        {
            var models = new List <NatisExportModel>();

            if (numberToExport <= 0)
            {
                return(Ok(models));
            }

            using (var dbContext = new DataContext())
            {
                var exports       = new List <TISRepository.NatisExport>();
                var tisRepository = new TISRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!tisRepository.GetNatisExports(numberToExport, districtID, out exports))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(tisRepository.Error)));
                }

                foreach (var export in exports)
                {
                    var model = new NatisExportModel();
                    model.ReferenceNumber      = export.ReferenceNumber;
                    model.InfringementDate     = export.InfringementDate;
                    model.ExportDate           = export.ExportDate;
                    model.VehicleRegistration  = export.VehicleRegistration;
                    model.LockedByCredentialID = export.LockedByCredentialID;
                    model.DistrictID           = export.DistrictID;
                    models.Add(model);
                }
            }
            return(Ok(models));

            //As EF alleenlik gebruik word(???):
            //var query = dbContext.NatisExports
            //    .AsNoTracking()
            //    .Take(numberToExport)
            //    .ToList();

            //var offences = query.OrderByDescending(f => f.InfringementDate).ToList();
        }