public ResponseResult UpdateCollectionPointLampInteraction(CPLampData data) { var insertedRows = 0; try { using (var conn = OpenConnection()) { insertedRows = conn.Query <int>("stp_VisitorToCollectionPoint_Insert", new { data.CPId, data.LampId, data.AssetId }, commandType: CommandType.StoredProcedure).FirstOrDefault(); } } catch (Exception ex) { return(new ResponseResult() { Status = 400, Message = $"Error inserting to DB, error message {ex.Message}" }); //throw (new Exception($"Error connecting to the DB, error message {ex.Message}")); } if (insertedRows >= 0) { return(new ResponseResult()); } else { return new ResponseResult() { Status = 206, Message = "Nothing was inserted to the DB" } }; }
public async void CollectionPointLamp(string cpId, string lampId) { var cpDetails = await _cmsDataHelper.GetCollectionPointDataById(cpId); var cpLampDetails = new CPLampData() { CPId = cpId, LampId = lampId, AssetId = cpDetails.Data.CollectionAssets.Iv.FirstOrDefault() //TODO - for now 1 option }; _dBManager.UpdateCollectionPointLampInteraction(cpLampDetails); var cpRequest = Mapper.Map <CPRequestParams>(cpDetails); SetLEDColors(cpRequest); }