public IActionResult Post([FromRoute] int id, [FromBody] Models.QRData qrData) { var qrCodeImage = this.GenerateQRCode(id, qrData.WithLogo); if (qrData.WithBatch) { qrCodeImage = this.AddText(qrCodeImage, $"Batch id: {id}"); } if (!string.IsNullOrEmpty(qrData.AdditionalText)) { qrCodeImage = this.AddText(qrCodeImage, qrData.AdditionalText, false); } var img = this.BitmapToBytes(qrCodeImage); return(this.Ok(Convert.ToBase64String(img))); }
public static bool IsValidQRCode(string qrCode, CheckInOutActions currentAction) { bool valid = false; try { Models.QRData qrData = JsonConvert.DeserializeObject <Models.QRData>(qrCode); if (qrData.deviceId != 0 && qrData.driverId != 0 && !string.IsNullOrEmpty(qrData.phoneNumber) && qrData.imei == Mvx.Resolve <IDeviceInfo>().IMEI&& qrData.actionPerformed == (int)currentAction) { valid = true; } } catch { } return(valid); }