Exemple #1
0
        public async Task UpdateKudosType(KudosTypeDTO dto)
        {
            var type = await _kudosTypesDbSet
                       .Where(_excludeNecessaryKudosTypes)
                       .FirstOrDefaultAsync(t => t.Id == dto.Id);

            if (type == null)
            {
                throw new ValidationException(ErrorCodes.ContentDoesNotExist, "Type not found");
            }

            type.Name        = dto.Name;
            type.Value       = dto.Value;
            type.Description = dto.Description;

            await _uow.SaveChangesAsync(dto.UserId);
        }
Exemple #2
0
        public async Task UpdateKudosType(KudosTypeDTO dto)
        {
            var type = await _kudosTypesDbSet
                       .FirstOrDefaultAsync(t => t.Id == dto.Id);

            if (type == null)
            {
                throw new ValidationException(ErrorCodes.ContentDoesNotExist, "Type not found");
            }

            if (type.Type == KudosTypeEnum.Ordinary)
            {
                type.Name        = dto.Name;
                type.Value       = dto.Value;
                type.Description = dto.Description;
            }

            type.IsActive = dto.IsActive;

            await _uow.SaveChangesAsync(dto.UserId);
        }