public async Task<bool> Post(string beerId, string upc)
{
var properties = new Dictionary<string, string>();
properties.Add("BeerId", beerId);
properties.Add("UPC", upc);
telemetryClient.TrackEvent("SaveBarcode", properties);
var beer = context.Beers.FirstOrDefault(x => x.Id == beerId);
if (beer == null)
return false;
try
{
beer.Upc = upc;
context.Beers.Add(beer);
context.SaveChanges();
return true;
}
catch(Exception ex)
{
telemetryClient.TrackException(ex);
return false;
}
}