Esempio n. 1
0
        /// <summary>
        /// Gets the discipline edit view.
        /// </summary>
        /// <param name="disciplineId">The discipline identifier.</param>
        /// <param name="userId"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">disciplineInfo</exception>
        public IDisciplineView GetDisciplineEditView(int disciplineId)
        {
            if (disciplineId <= 0)
            {
                throw new ArgumentNullException(nameof(disciplineId));
            }

            var disciplineInfo = disciplineRepository.GetDisciplineById(disciplineId);

            var userInfo = this.usersRepository.GetUserById((int)session.GetSessionValue(SessionKey.UserId));


            var companyInfo = this.companyRepository.GetCompanyById((int)this.session.GetSessionValue(SessionKey.CompanyId));

            if (disciplineInfo == null)
            {
                throw new ArgumentNullException(nameof(disciplineInfo));
            }

            var employeeCollecction = lookupRepository.GetEmployeeByCompanyId(companyInfo.CompanyId);


            var queryStatusCollection = this.lookupRepository.GetQueryStatus();

            var actionTakenCollection = this.lookupRepository.GetActionTaken();

            var viewModel = this.disciplineViewModelFactory.CreateEditDisciplingView(disciplineInfo, employeeCollecction,
                                                                                     queryStatusCollection, actionTakenCollection);

            return(viewModel);
        }