/// <summary> /// This method receives a Fermentabuoy entity from the service and inserts the data into the SQLite DB /// </summary> /// <param name="buoy"> The Entity that is received from the service</param> /// <returns></returns> public async Task UpdateFermentabuoy(Fermentabuoy buoy) { string sql = "Update Fermentabuoy set DeviceId = @DeviceId, DeviceNumber = @DeviceNumber, MacAddress = @MacAddress where Id = @Id;"; using (IDbConnection db = new SqliteConnection(_configuration.GetConnectionString("SabreSpringsBrewing"))) { await db.ExecuteAsync(sql, buoy); } }
/// <summary> /// This method receives a Fermentabuoy entity from the service and inserts the data into the SQLite DB /// </summary> /// <param name="buoy"> The Entity that is received from the service</param> /// <returns></returns> public async Task AddFermentabuoy(Fermentabuoy buoy) { string sql = "Insert into Fermentabuoy (DeviceId, DeviceNumber, MacAddress, Created, CreatedBy) " + "VALUES (@DeviceId, @DeviceNumber, @MacAddress, @Created, @CreatedBy);"; using (IDbConnection db = new SqliteConnection(_configuration.GetConnectionString("SabreSpringsBrewing"))) { await db.ExecuteAsync(sql, buoy); } }
/// <summary> /// Retrieves a Fermentabuoy entity from the database /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <Fermentabuoy> GetFermentabuoy(int id) { Fermentabuoy buoy = new Fermentabuoy(); string sql = @"Select * from Fermentabuoy where Id = @Id;"; using (IDbConnection db = new SqliteConnection(_configuration.GetConnectionString("SabreSpringsBrewing"))) { buoy = await db.QueryFirstAsync <Fermentabuoy>(sql, new { Id = id }); } return(buoy); }
public async Task AddFermentabuoy(FermentabuoyDto dto) { Fermentabuoy entity = new Fermentabuoy() { DeviceId = dto.DeviceId, DeviceNumber = dto.DeviceNumber, MacAddress = dto.MacAddress, CreatedBy = dto.CreatedBy, Created = DateTime.Now }; await FermentabuoyDataProvider.AddFermentabuoy(entity); }
public async Task <FermentabuoyDto> GetFermentabuoy(int id) { Fermentabuoy entity = await FermentabuoyDataProvider.GetFermentabuoy(id); FermentabuoyDto dto = new FermentabuoyDto() { DeviceId = entity.DeviceId, DeviceNumber = entity.DeviceNumber, MacAddress = entity.MacAddress, Created = entity.Created, CreatedBy = entity.CreatedBy }; return(dto); }