public ContractAppService(IContractRepository repo, IContractPartRepository contractPartRepo, IUnitOfWork uow, IPathFinderService pathFinderService) { _repo = repo; _contractPartRepo = contractPartRepo; _uow = uow; _pathFinderService = pathFinderService; }
public WorldService(ICompanyEmployeeRepository companyEmployeeRepository, IContractRepository contractRepository, IContractService contractService, ICitizenRepository citizenRepository, IConfigurationRepository configurationRepository, IEquipmentRepository equipmentRepository, IPartyService partyService, ICongressCandidateService congressCandidateService, ICongressVotingService congressVotingService, ICountryService countryService, IBattleService battleService, IRegionService regionService, ICompanyService companyService, IEmbargoService embargoService, IWarService warService, IEmployeeService employeeService, IMPPService mppService, IWalletService walletService, INewDayRepository newDayRepository, IHotelService hotelService, IHouseService houseService) { this.citizenRepository = citizenRepository; this.configurationRepository = configurationRepository; this.equipmentRepository = equipmentRepository; this.companyEmployeeRepository = companyEmployeeRepository; this.contractRepository = contractRepository; this.contractService = contractService; this.partyService = partyService; this.congressCandidateService = congressCandidateService; this.congressVotingService = congressVotingService; this.countryService = countryService; this.battleService = battleService; this.regionService = regionService; this.companyService = companyService; this.embargoService = embargoService; this.warService = warService; this.employeeService = employeeService; this.mppService = mppService; this.walletService = Attach(walletService); this.newDayRepository = newDayRepository; this.hotelService = hotelService; this.houseService = houseService; citizenRepository.SetTimeout(300); equipmentRepository.SetTimeout(300); }
public GetAllContracsQueryHandler(IAuthenticatedUserService authenticatedUserService, IContractRepository contractRepository ) { _authenticatedUserService = authenticatedUserService; _contractRepository = contractRepository; }
public ContractsController(IContractRepository contractRepository, IPortfolioRepository portfolioRepository, IGeographicalZoneRepository geographicalZoneRepository) { this.contractRepository = contractRepository; this.portfolioRepository = portfolioRepository; this.geographicalZoneRepository = geographicalZoneRepository; }
public void Initialize() { //Initialize serves as the "Composition Root" _contractRepository = A.Fake <IContractRepository>(); A.CallTo(() => _contractRepository.GetById(ValidContractId)) .Returns(new DTO.ContractDto { ContractID = ValidContractId, ExpirationDate = DateTime.Now.AddDays(1) }); A.CallTo(() => _contractRepository.GetById(ExpiredContractId)) .Returns(new DTO.ContractDto { ContractID = ExpiredContractId, ExpirationDate = DateTime.Now.AddDays(-1) }); A.CallTo(() => _contractRepository.GetById(InvalidContractId)) .Throws <ContractNotFoundException>(); AutoMapper.Mapper.CreateMap <DTO.ContractDto, Contract>(); _contractService = new ContractService(_contractRepository); }
public ContractorsController(IContractorRepository contractorRepo, ILocalizationRepository localizationRepo, IBusinessTypeRepository businessTypeRepo, IEmployeeRepository employeeTypesRepo, IVehicleRepository vehicleRepo, IContractRepository contractRepo, IEmployeeRelationshipTypeRepository employeeRelationshipTypeRepo, IWorkflowMessageService workflowMessageServ, IIdentityMessageService emailServ) { contractorRepository = contractorRepo; localizationRepository = localizationRepo; businessTypeRepository = businessTypeRepo; employeeRepository = employeeTypesRepo; vehicleRepository = vehicleRepo; contractRepository = contractRepo; employeeRelationshipTypeRepository = employeeRelationshipTypeRepo; emailService = emailServ; workflowMessageService = workflowMessageServ; userManager = new UserManager <ContractorUser>(new UserStore <ContractorUser>(new ApplicationDbContext())); userManager.UserValidator = new UserValidator <ContractorUser>(userManager) { AllowOnlyAlphanumericUserNames = true, RequireUniqueEmail = true }; var provider = new DpapiDataProtectionProvider("SampleAppName"); userManager.UserTokenProvider = new DataProtectorTokenProvider <ContractorUser>(provider.Create("SampleTokenName")); userManager.EmailService = emailService; }
public void Initialize() { // All the setup needs to happen here // Even the auto mapping needs to be setup here // Initialize serves as the "composition route" _contractRepository = A.Fake <IContractRepository>(); _contractService = new ContractService(_contractRepository); A.CallTo(() => _contractRepository.GetById(ValidContractId)) .Returns(new ContractDto { ContractId = ValidContractId, ExpirationDate = DateTime.Now.AddDays(1) }); A.CallTo(() => _contractRepository.GetById(ExpiredContractId)) .Returns(new ContractDto { ContractId = ExpiredContractId, ExpirationDate = DateTime.Now.AddDays(-1) }); A.CallTo(() => _contractRepository.GetById(InvalidContractId)) .Throws <ContractNotFoundException>(); AutoMapper.Mapper.Initialize(cfg => cfg.CreateMap <ContractDto, Contract>()); }
public SeedData(ApplicationDbContext dbContext, IPlayerRepository playerRepository, ITeamRepository teamRepository, IContractRepository contractRepository) { _dbContext = dbContext; _playerRepository = playerRepository; _teamRepository = teamRepository; _contractRepository = contractRepository; }
public RequirementService(IContractorRepository contractorRepo, IContractRepository contractRepo, IEmployeeRepository employeeRepo, IVehicleRepository vehicleRepo) { contractorRepository = contractorRepo; contractRepository = contractRepo; employeeRepository = employeeRepo; vehicleRepository = vehicleRepo; }
public InvoiceController(IInvoiceRepository invoice, IContractRepository contract, IMapper mapper, IToastNotification toastNotification) { _invoice = invoice; _mapper = mapper; _contract = contract; _toastNotification = toastNotification; }
public void Initialize() { //Initialize serves as the "Composition Root" _contractRepository = A.Fake <IContractRepository>(); _partServiceRepository = A.Fake <IPartServiceRepository>(); A.CallTo(() => _contractRepository.GetById(ValidContractId)) .Returns(new DTO.ContractDto { ContractID = ValidContractId, ExpirationDate = DateTime.Now.AddDays(1) }); A.CallTo(() => _contractRepository.GetById(ExpiredContractId)) .Returns(new DTO.ContractDto { ContractID = ExpiredContractId, ExpirationDate = DateTime.Now.AddDays(-1) }); A.CallTo(() => _partServiceRepository.GetById(ValidPartId)) .Returns(new DTO.PartDto { PartId = ValidPartId, Price = ValidPartPrice }); AutoMapper.Mapper.CreateMap <DTO.ContractDto, Contract>(); AutoMapper.Mapper.CreateMap <DTO.PartDto, Part>(); _contractService = new ContractService(_contractRepository); }
public WashBll(IWashRepository washRepository, IOperationRepository operationRepository, IContractRepository contractRepository) { _washRepository = washRepository; _operationRepository = operationRepository; _contractRepository = contractRepository; }
public ContractController(IContractRepository contractRepository, IHouseRepository houseRepository, IUnitOfWork unitOfWork, IMapper mapper) { ContractRepository = contractRepository; HouseRepository = houseRepository; UnitOfWork = unitOfWork; Mapper = mapper; }
protected virtual void Dispose(bool disposing) { if (disposing) { // Free managed resources if (contractorRepository != null) { contractorRepository.Dispose(); contractorRepository = null; } if (contractRepository != null) { contractRepository.Dispose(); contractRepository = null; } if (employeeRepository != null) { employeeRepository.Dispose(); employeeRepository = null; } if (vehicleRepository != null) { vehicleRepository.Dispose(); vehicleRepository = null; } } }
/// <summary> /// Initialize comment controller /// </summary> /// <param name="classCalendarRepo">Class calendar repository</param> /// <param name="userprofileRepo">UserProfile repository</param> /// <param name="userActivityRepo">User activity repository</param> /// <param name="classRoomRepo">Class room repository</param> /// <param name="studentKeyRepo">Student key repository</param> /// <param name="lessonCatalogRepo">Lesson catalog repository</param> /// <param name="contractRepo">Contract repository</param> /// <param name="likeCommentRepo">Like comment repository</param> /// <param name="likeDiscussionRepo">Like discussion repository</param> /// <param name="likeLessonRepo">Like lesson repository</param> /// <param name="courseCatalogRepo">Course catalog repository</param> public MyCourseController(IClassCalendarRepository classCalendarRepo, IUserProfileRepository userprofileRepo, IUserActivityRepository userActivityRepo, IClassRoomRepository classRoomRepo, IStudentKeyRepository studentKeyRepo, ILessonCatalogRepository lessonCatalogRepo, ILikeLessonRepository likeLessonRepo, ILikeCommentRepository likeCommentRepo, ILikeDiscussionRepository likeDiscussionRepo, IContractRepository contractRepo, ICourseCatalogRepository courseCatalogRepo, ILoggerFactory loggerFactory, IDateTime dateTime) { _classCalendarRepo = classCalendarRepo; _userprofileRepo = userprofileRepo; _userActivityRepo = userActivityRepo; _classRoomRepo = classRoomRepo; _studentKeyRepo = studentKeyRepo; _lessonCatalogRepo = lessonCatalogRepo; _likeLessonRepo = likeLessonRepo; _likeCommentRepo = likeCommentRepo; _likeDiscussionRepo = likeDiscussionRepo; _contractRepo = contractRepo; _courseCatalogRepo = courseCatalogRepo; _logger = loggerFactory.CreateLogger<MyCourseController>(); _dateTime = dateTime; }
public ContractController(IContractRepository contractRepository, IGadgetRepository gadgetRepository, IMapper mapper, IAccountService accountService) { _contractRepository = contractRepository; _gadgetRepository = gadgetRepository; _mapper = mapper; _accountService = accountService; }
public DocumentFieldController( IDocumentFieldRepository _DocumentField , IUserRepository _user , IDocumentAttributeRepository DocumentAttribute , IPageRepository page , IUserTypePageRepository userTypePage , ILogDocumentAttributeRepository logDocumentAttribute , ICategoryRepository category , IContractRepository contract , ILabourContractRepository labourContract , IObjectAttributeRepository objectAttribute , IInternalNotificationsRepository _InternalNotifications ) { DocumentFieldRepository = _DocumentField; userRepository = _user; DocumentAttributeRepository = DocumentAttribute; pageRepository = page; userTypePageRepository = userTypePage; LogDocumentAttributeRepositorty = logDocumentAttribute; categoryRepository = category; contractRepository = contract; labourContractRepository = labourContract; InternalNotificationsRepository = _InternalNotifications; ObjectAttributeRepository = objectAttribute; }
public AddInvoiceCommandHandler(IInvoiceRepository invoiceRepository, IMapper mapper, IContractRepository contractRepository, ITaskRepository taskRepository) { _invoiceRepository = invoiceRepository ?? throw new ArgumentNullException(nameof(invoiceRepository)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository)); _taskRepository = taskRepository ?? throw new ArgumentNullException(nameof(taskRepository)); }
public NetworkService(INetworkRepository networkRepository, IPlanRepository planRepository, INetworkTariffRepository networkTariffRepository, IPlanTariffRepository planTariffRepository, IContractRepository contractRepository) { _networkRepository = networkRepository; _planRepository = planRepository; _networkTariffRepository = networkTariffRepository; _planTariffRepository = planTariffRepository; _contractRepository = contractRepository; }
public ProjectController(IProjectRepository mainRepository, IProjectInspectionTypeRepository projectInspectionTypeRepository, IContractRepository contractRepository, IBridgeRepository bridgeRepository, IOptions <PageSettings> pageSettings) { _mainRepository = mainRepository; _projectInspectionTypeRepository = projectInspectionTypeRepository; _contractRepository = contractRepository; _bridgeRepository = bridgeRepository; _pageSettings = pageSettings; }
public PropertyApplication(IPropertyRepository propertyRepository, IMapper mapper, IPropertyImageRepository propertyImageRepository, IContractRepository contractRepository) : base(propertyRepository, mapper) { this.propertyRepository = propertyRepository; this.contractRepository = contractRepository; this.propertyImageRepository = propertyImageRepository; }
public EmployeeWorkflow(IEmployeeRepository employeeRepository, IContractRepository contractRepository, IRequestRepository requestRepository, IAdditionalDaysRepository additionalDaysOffRepository, IAccountRepository accountRepository) { EmployeeRepository = employeeRepository; ContractRepository = contractRepository; RequestRepository = requestRepository; AdditionalDaysRepository = additionalDaysOffRepository; AccountRepository = accountRepository; }
public ContractsController(IContractRepository repository, IMediator mediator, IMapper mapper) { _repository = repository; _mediator = mediator; _mapper = mapper; }
public ContractsController(IContractRepository contractRepository, ISelectListRepository selectListRepository, IApplicationForAdmissionRepository applicationForAdmissionRepository) { _contractRepository = contractRepository; _selectListRepository = selectListRepository; _applicationForAdmissionRepository = applicationForAdmissionRepository; }
public PlataController(IPlataRepository repository, IContractRepository contractRepository, ClientController clientController, IAbonamentRepository abonamentRepository) { this.plataRepository = repository; this.contractRepository = contractRepository; this.abonamentRepository = abonamentRepository; this.contractController = new ContractController(this.contractRepository, clientController, this.plataRepository, this.abonamentRepository); }
public ContractCreationTransactionProcessor( Web3.Web3 web3, IContractRepository contractRepository, ITransactionRepository transactionRepository, IAddressTransactionRepository addressTransactionRepository) { _web3 = web3; _contractRepository = contractRepository; _transactionRepository = transactionRepository; _addressTransactionRepository = addressTransactionRepository; }
public ClientController(IContractRepository contractRepo, ILetterRepository letterRepo, IUserRepository userRepo, IHostingEnvironment hostingEnvironment, IProjectRepository projectRepo) { this.contractRepo = contractRepo; _letterRepo = letterRepo; _userRepo = userRepo; _hostingEnvironment = hostingEnvironment; _projectRepo = projectRepo; }
public ContractController(IContractRepository contractRepository, ICreditCardRepository creditCardRepository, IUserService userService) { _contractRepository = contractRepository; _creditCardRepository = creditCardRepository; _userService = userService; }
public ContractsController(IContractRepository contractRepository, ILoggerService logger, IMapper mapper) { _contractRepository = contractRepository; _logger = logger; _mapper = mapper; }
public EmployeeController(IEmployeeRepository employeeRepository, IContractRepository contractRepository, IDepartmentRepository departmentRepository) { this._employeeRepository = employeeRepository; this._contractRepository = contractRepository; this._departmentRepository = departmentRepository; }
/// <summary>Initializes a new instance of the <see cref="ContractController" /> class.</summary> /// <param name="repository">The repository.</param> public ContractController(IContractRepository repository, ClientController clientController, IPlataRepository plataRepository, IAbonamentRepository abonamentRepository) { this.contractRepository = repository; this.clientController = clientController; this.plataRepository = plataRepository; this.abonamentRepository = abonamentRepository; }
public ContractSelectController(IContractRepository contract, IUserRepository user, IForeignAgencyRepository agency, IContractSelectRepository select, IMapper mapper, IToastNotification toastNotification) { _contrat = contract; _mapper = mapper; _toastNotification = toastNotification; _select = select; _user = user; _agency = agency; }
public ContractService(IPipelineRepository IpipelineRepository, INominationsRepository INominationsRepository, IContractRepository IContractRepository, ILocationRepository ILocationRepository, ImetadataRequestTypeRepository ImetadataRequestTypeRepository, IModalFactory modalFactory) { _INominationsRepository = INominationsRepository; _IContractRepository = IContractRepository; _ILocationRepository = ILocationRepository; _ImetadataRequestTypeRepository = ImetadataRequestTypeRepository; this.IpipelineRepository = IpipelineRepository; this.modalFactory = modalFactory; }
public ContractController(IContractRepository repository, string catalog, LoginView view) { this._LoginId = view.LoginId.ToLong(); this._UserId = view.UserId.ToInt(); this._OfficeId = view.OfficeId.ToInt(); this._Catalog = catalog; this.ContractRepository = repository; }
public ScrubbingService(IInvoicingService invoicingService, IContractRepository contractRepository, Import.ICallDataImportManager importManager, IAccountRepository accountRepository, IInvoiceRepository invoiceRepository) { _invoicingService = invoicingService; _contractRepository = contractRepository; _importManager = importManager; _accountRepository = accountRepository; _invoiceRepository = invoiceRepository; }
public ContractController() { this._LoginId = AppUsers.GetCurrent().View.LoginId.ToLong(); this._UserId = AppUsers.GetCurrent().View.UserId.ToInt(); this._OfficeId = AppUsers.GetCurrent().View.OfficeId.ToInt(); this._Catalog = AppUsers.GetCurrentUserDB(); this.ContractRepository = new MixERP.Net.Core.Modules.HRM.Data.Contract { _Catalog = this._Catalog, _LoginId = this._LoginId, _UserId = this._UserId }; }
public PackageLookup(ICustomerRepository customerRepository, IActionRepository actionRepository, IUserPackageRepository userPackageRepository, IRolePackageRepository rolePackageRepository, IGroupPackageRepository groupPackageRepository, IContractRepository contractRepository, IContractPackageRepository contractPackageRepository) { _customerRepository = customerRepository; _actionRepository = actionRepository; _userPackageRepository = userPackageRepository; _rolePackageRepository = rolePackageRepository; _groupPackageRepository = groupPackageRepository; _contractRepository = contractRepository; _contractPackageRepository = contractPackageRepository; }
public InvoicingService(IInvoiceRepository invoiceRepository, IAccountRepository accountRepository, IPlanRepository planRepository, INetworkRepository networkRepository, IContractRepository contractRepository, IContactRepository contactRepository, ICompanyRepository companyRepository, INumberGeneratorService numberGeneratorService, ISettingRepository settingRepository, ICustomFeeRepository customFeeRepository, IInvoiceHardcopyRepository hardcopyRepository, IContractService contractService, IInvoiceSettings invoiceSettings, IEwayPaymentsService ewayPaymentsService, IDateTimeFacade dateTime) { _invoiceRepository = invoiceRepository; _accountRepository = accountRepository; _planRepository = planRepository; _networkRepository = networkRepository; _contractRepository = contractRepository; _contactRepository = contactRepository; _companyRepository = companyRepository; _numberGeneratorService = numberGeneratorService; _settingRepository = settingRepository; _contractService = contractService; _customFeeRepository = customFeeRepository; _invoiceHardcopyRepository = hardcopyRepository; _invoiceSettings = invoiceSettings; _ewayPaymentsService = ewayPaymentsService; _dateTime = dateTime; }
private async Task createNewContracts(IContractRepository repo, IEnumerable<Contract> allContracts, IEnumerable<repoModel.Contract> mongoDBcontracts) { var needToCreateContracts = allContracts.Where(it => mongoDBcontracts.All(c => c.id != it.Id.ToString())); foreach (var efContract in needToCreateContracts) { var licenseQry = efContract.Licenses .Select(it => new repoModel.Contract.License { id = it.Id.ToString(), CourseCatalogId = it.CourseCatalogId.ToString(), CourseName = it.CourseName, CreatedDate = it.RecLog.CreatedDate, DeletedDate = it.RecLog.DeletedDate, Grade = it.Grade, StudentsCapacity = it.StudentsCapacity, TeacherKeys = it.TeacherKeys.Select(tk => new repoModel.Contract.TeacherKey { id = tk.Id.ToString(), Code = tk.Code, CreatedDate = tk.RecLog.CreatedDate, DeletedDate = tk.RecLog.DeletedDate, Grade = tk.Grade }) }); var contract = new repoModel.Contract { id = efContract.Id.ToString(), SchoolName = efContract.SchoolName, City = efContract.City, State = efContract.State, ZipCode = efContract.ZipCode, PrimaryContractName = efContract.PrimaryContractName, PrimaryPhoneNumber = efContract.PrimaryPhoneNumber, PrimaryEmail = efContract.PrimaryEmail, SecondaryContractName = efContract.SecondaryContractName, SecondaryPhoneNumber = efContract.SecondaryPhoneNumber, SecondaryEmail = efContract.SecondaryEmail, StartDate = efContract.StartDate, ExpiredDate = efContract.ExpiredDate, TimeZone = efContract.TimeZone, CreatedDate = efContract.RecLog.CreatedDate, DeletedDate = efContract.RecLog.DeletedDate, Licenses = licenseQry.ToList(), }; await repo.UpsertContract(contract); } }
public ContractController(IContractRepository contractRepo, ICapabilityRepository capRepo) { this._contractRepo = contractRepo; this._capRepo = capRepo; }
/// <summary> ///In constructor, we can get needed classes/interfaces. ///They are sent here by dependency injection system automatically. /// </summary> public ContractAppService(IContractRepository contractRepository, IAccountRepository accountRepository) { _contractRepository = contractRepository; _accountRepository = accountRepository; }
private async Task updateContracts(IContractRepository repo, IEnumerable<Contract> allContracts, IEnumerable<repoModel.Contract> mongoDBcontracts) { foreach (var mongoDBContract in mongoDBcontracts) { var contract = allContracts.FirstOrDefault(it => it.Id.ToString() == mongoDBContract.id); if (contract == null) continue; var licenseQry = contract.Licenses .Select(it => new repoModel.Contract.License { id = it.Id.ToString(), CourseCatalogId = it.CourseCatalogId.ToString(), CourseName = it.CourseName, CreatedDate = it.RecLog.CreatedDate, DeletedDate = it.RecLog.DeletedDate, Grade = it.Grade, StudentsCapacity = it.StudentsCapacity, TeacherKeys = it.TeacherKeys.Select(tk => new repoModel.Contract.TeacherKey { id = tk.Id.ToString(), Code = tk.Code, CreatedDate = tk.RecLog.CreatedDate, DeletedDate = tk.RecLog.DeletedDate, Grade = tk.Grade }) }); mongoDBContract.SchoolName = contract.SchoolName; mongoDBContract.City = contract.City; mongoDBContract.State = contract.State; mongoDBContract.ZipCode = contract.ZipCode; mongoDBContract.PrimaryContractName = contract.PrimaryContractName; mongoDBContract.PrimaryPhoneNumber = contract.PrimaryPhoneNumber; mongoDBContract.PrimaryEmail = contract.PrimaryEmail; mongoDBContract.SecondaryContractName = contract.SecondaryContractName; mongoDBContract.SecondaryPhoneNumber = contract.SecondaryPhoneNumber; mongoDBContract.SecondaryEmail = contract.SecondaryEmail; mongoDBContract.StartDate = contract.StartDate; mongoDBContract.ExpiredDate = contract.ExpiredDate; mongoDBContract.TimeZone = contract.TimeZone; mongoDBContract.CreatedDate = contract.RecLog.CreatedDate; mongoDBContract.DeletedDate = contract.RecLog.DeletedDate; mongoDBContract.Licenses = licenseQry.ToList(); await repo.UpsertContract(mongoDBContract); } }
public ContractService(IContractRepository contractRepository, IUnitOfWork unitOfWork) { ContractRepository = contractRepository; UnitOfWork = unitOfWork; }
public InvoiceDataFileCreator(IAccountRepository accountRepository, IContractRepository contractRepository) { _accountRepository = accountRepository; _contractRepository = contractRepository; }
public override void MyTestInitialize() { base.MyTestInitialize(); contractRepository = RepositoryFactory.GetRepository<IContractRepository>(); }
public ContractTest() { _rep = new ContractRepository(@"Data Source=CHUDO-HP\SQLDEV;Initial Catalog=web_doverie;Integrated Security=True"); }
public ContractSearchProvider(IContractRepository repository) { this.repository = repository; }
public ContractService(IContractRepository contractRepository) { _contractRepository = contractRepository; }
public ContractStatusMonitor(IContractRepository contract) { contractRepository = contract; }
public ContractBll(IContractRepository contractRepository, ITypeMapper typeMapper) { _contractRepository = contractRepository; _typeMapper = typeMapper; }
public ContractModule(IBus bus, IContractRepository contracts, IContractBundleRepository contractBundles) { if (_defaultJsonMaxLength == 0) _defaultJsonMaxLength = JsonSettings.MaxJsonLength; //Hackeroonie - Required, due to complex model structures (Nancy default restriction length [102400]) JsonSettings.MaxJsonLength = Int32.MaxValue; Get["/Contracts"] = _ => { var model = this.Bind<DataTablesViewModel>(); var dto = (IEnumerable<ContractDto>) Mapper.Map<IEnumerable<Contract>, IEnumerable<ContractDto>>(contracts);//.Search(Context.Request.Query["search[value]"].Value, model.Start, model.Length)); return Negotiate .WithView("Index") .WithMediaRangeModel(MediaRange.FromString("application/json"), new { data = dto.Where(x => x.IsActive).ToList() }); }; Get["/Contracts/Add"] = parameters => { return View["Save", new ContractDto { CommencementDate = DateTime.Today, OnlineAcceptance = DateTime.Today, ContractBundleList = contractBundles.OrderBy(x => x.TransactionLimit) }]; }; Post["/Contracts"] = _ => { var dto = this.BindAndValidate<ContractDto>(); dto.CreatedBy = Context.CurrentUser.UserName; dto.IsActive = true; if (ModelValidationResult.IsValid) { var entity = Mapper.Map(dto, contracts.Get(dto.Id)); bus.Publish(new CreateUpdateEntity(entity, "Create")); return View["Index"]; } return View["Save", dto]; }; Get["/Contracts/{id}"] = parameters => { var guid = (Guid)parameters.id; var dto = Mapper.Map<Contract, ContractDto>(contracts.Get(guid)); dto.ContractBundleList = contractBundles.OrderBy(x => x.TransactionLimit); return View["Save", dto]; }; Get["/Contracts/Details/{id}"] = parameters => { var guid = (Guid)parameters.id; var dto = Mapper.Map<Contract, ContractDto>(contracts.Get(guid)); return Response.AsJson(dto); }; Put["/Contracts/{id}"] = parameters => { var dto = this.BindAndValidate<ContractDto>(); dto.ModifiedBy = Context.CurrentUser.UserName; if (ModelValidationResult.IsValid) { var entity = Mapper.Map(dto, contracts.Get(dto.Id)); bus.Publish(new CreateUpdateEntity(entity, "Update")); return View["Index"]; } return View["Save", dto]; }; //Post["/Contracts/GetPackage"] = _ => //{ // var dto = this.Bind<ContractPackageRequestDto>(); // if (dto == null) // return Response.AsJson(new { }); // var handler = new GetContractPackageHandler(contracts); // handler.Handle(new GetPackageOnContract(dto.ContractId)); // return Response.AsJson(handler.Response); //}; Delete["/Contracts/{id}"] = _ => { this.RequiresAnyClaim(new[] { RoleType.Admin.ToString(), RoleType.ProductManager.ToString(), RoleType.Support.ToString() }); var dto = this.Bind<ContractDto>(); var entity = contracts.Get(dto.Id); bus.Publish(new SoftDeleteEntity(entity)); return Response.AsJson("Contract has been soft deleted"); }; }