//[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()); } }
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)); } }
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(); }