public string CreateDeviceAuth(DeviceAuthRequest authCode) { if (authCode.AuthCode != _authCode) return null; authCode.AuthCode = Guid.NewGuid().ToString(); var result = _repository.Save(authCode); return result ? authCode.AuthCode : null; }
public bool Save(DeviceAuthRequest auth) { var query = new DapperQuery(ConnectionString) { Sql = @"INSERT INTO [DeviceAuthentication] ([Code], [Name]) VALUES (@Code, @Name)", Parameters = new { Code = auth.AuthCode, Name = auth.Name } }; try { QueryExecutor.Execute(query); } catch (Exception) { return false; } return true; }
public bool Save(DeviceAuthRequest auth) { _repo.Add(auth); return true; }