public async Task <bool> UpdateDivisionAsync(Guid divisionId, DivisionForm form)
        {
            var entity = await _divisionRepository.GetByIdAsync(divisionId);


            if (!form.SeasonInfoId.IsNullOrEmpty() && form.SeasonInfoId != entity.SeasonInfoId)
            {
                entity.SeasonInfoId = form.SeasonInfoId;
            }

            if (!form.Name.IsNullOrEmpty() && form.Name != entity.Name)
            {
                entity.Name = form.Name;
            }

            if (!form.UpperLimit.IsNullOrEmpty() && form.UpperLimit != entity.UpperLimit)
            {
                entity.UpperLimit = form.UpperLimit;
            }

            if (!form.LowerLimit.IsNullOrEmpty() && form.LowerLimit != entity.LowerLimit)
            {
                entity.LowerLimit = form.LowerLimit;
            }

            return(await _divisionRepository.UpdateDivisionAsync(entity));
        }
Esempio n. 2
0
        public Division GetByIdAsync(int id)
        {
            if (id <= 0)
            {
                throw new ArgumentException("id错误");
            }

            return(_divisionRepository.GetByIdAsync(id));
        }