Esempio n. 1
0
        public CrRatingCalcConfig UpdateCrRatingConfig(CrRatingCalcConfig config, int userId)
        {
            var mappedConfig = Mapper.Map <DAL.EntityFramework.CrRatingCalcConfig>(config);

            mappedConfig.LastModifiedById = userId;
            mappedConfig.LastModifiedOn   = DateTime.Now;

            //set each rangemin to previous element's rangemax
            for (var index = 1; index < mappedConfig.CrRatingCalcRangeConfigs.Count; index++)
            {
                mappedConfig.CrRatingCalcRangeConfigs.ElementAt(index).RangeMin = mappedConfig.CrRatingCalcRangeConfigs
                                                                                  .ElementAt(index - 1)
                                                                                  .RangeMax;
            }
            UnitOfWork.CodeReviewRepository.UpdateCrRatingCalcConfig(mappedConfig);
            UnitOfWork.Commit();

            return
                (GetCrRatingConfig(userId));
        }