示例#1
0
        public async Task <IActionResult> PutBitmap(string fiosid, int bitmapid, [FromBody] Image logo)
        {
            try
            {
                _logger.LogTrace("Begin. params: fiosid={0}, bitmapid={1}, logo={2}", fiosid, bitmapid, logo != null);
                await _bitmapRepo.UpdateBitmap(logo, bitmapid.ToString());

                var response = await _bitmapRepo.UpdateChannelBitmap(bitmapid);

                response += await _stationRepo.UpdateBitmap(fiosid, bitmapid);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
        public async Task <IActionResult> Put(int bitmapid, string fiosid)
        {
            try
            {
                _logger.LogTrace("Begin. params: bitmapid={0}, fiosid={1}", bitmapid, fiosid);
                int maxVal = int.Parse(this._config.GetValue <string>("FiosChannelData:DefaultLogoId"));
                if (bitmapid <= 0 || bitmapid > maxVal)
                {
                    _logger.LogWarning("Invalid ID. Must be greater than 0 and less than {0}. Provided value: {1}", maxVal, bitmapid);
                    return(BadRequest());
                }
                var retVal = await _stationRepo.UpdateBitmap(fiosid, bitmapid);

                retVal += await _bitmapRepo.UpdateChannelBitmap(bitmapid);

                return(Ok(retVal));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message + ex.StackTrace);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }