Example #1
0
        public async Task <IActionResult> PutColorCode(int Id, ColorCode colorCode)
        {
            if (Id != colorCode.Id)
            {
                return(BadRequest());
            }


            try
            {
                var updatedColorCode = new ColorCode(id: Id, code: colorCode.Code, createdDate: colorCode.CreatedDate, isActive: colorCode.IsActive, createdBy: colorCode.CreatedBy);
                await _colorCodeRepository.UpdateAsync(updatedColorCode);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!await(ColorCodeExists(colorCode)))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }