Example #1
0
        public async Task <ActionResult> Update([FromRoute] int id, [FromBody] VideoCardCoreUpdateDto videoCardCore)
        {
            _logger.LogForModelUpdate(HttpContext, id);

            var result = await _videoCardCoresService.UpdateVideoCardCoreAsync(id, videoCardCore);

            return(result ? Json(videoCardCore) : ResponseResultsHelper.UpdateError());
        }
Example #2
0
        /// <inheritdoc/>
        public async Task <bool> UpdateVideoCardCoreAsync(int id, VideoCardCoreUpdateDto videoCardCore)
        {
            var dataBaseEntity = await _unitOfWorkHardwareAPI.VideoCardCoresRepository.GetByIdAsync(id);

            if (dataBaseEntity == null)
            {
                return(false);
            }

            _mapper.Map(videoCardCore, dataBaseEntity);
            var updateResult = await _unitOfWorkHardwareAPI.VideoCardCoresRepository.UpdateAsync(dataBaseEntity);

            if (!updateResult)
            {
                return(false);
            }

            return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0);
        }