public QRCodeConfigResponse UpdateQRCodeRegerateTime(QRCodeConfigurationViewModel configInfo) { _logger.LogInfo("Trying to update configuration time"); try { //Get QR Code configuration based on id QRCodeConfiguration qrConfig = _configurationRepo.GetQRConfigurationById(configInfo.Id); //Throw exception if null if (qrConfig == null) { throw new Exception(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidQRConfiguration))); } //Updated Time qrConfig.RegenerationTimeInMin = configInfo.RegenerationTimeInMin; _configurationRepo.UpdateQRCodeRegerateTime(qrConfig); _logger.LogInfo("Updated configuration time"); QRCodeConfigResponse response = new QRCodeConfigResponse(true, "Successfully saved"); return(response); } catch (Exception ex) { _logger.LogInfo(ex.Message); return(new QRCodeConfigResponse(false, ex.Message)); } }
public async void UpdateQRCodeRegerateTime(QRCodeConfiguration qrConfig) { this.GetDbSet <QRCodeConfiguration>().Attach(qrConfig); this._context.Entry(qrConfig).State = EntityState.Modified; await this._unitOfWork.CompleteAsync(); }