Esempio n. 1
0
        public async Task <IActionResult> Create(ServiceMerchantViewModel serviceMerchantModel)
        {
            var service = await _serviceRepository.Get(serviceMerchantModel.ServiceId);

            var serviceMerchant = await _merchantRepository.Get(serviceMerchantModel.MerchantId);

            if (service != null && serviceMerchant != null)
            {
                ServiceMerchant newServiceMerchant = new ServiceMerchant()
                {
                    AppId            = serviceMerchantModel.AppId,
                    TRId             = serviceMerchantModel.TRId,
                    RelationshipName = serviceMerchantModel.RelationshipName,
                    Status           = serviceMerchantModel.Status,
                    Created          = DateTime.UtcNow,
                    ServiceId        = service.Id,
                    MerchantId       = serviceMerchant.Id,
                    Updated          = null
                };

                await _serviceMerchantRepository.Insert(newServiceMerchant);
            }

            return(RedirectToAction("List"));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create()
        {
            ServiceMerchantViewModel serviceMerchant = new ServiceMerchantViewModel()
            {
                Services  = await _serviceRepository.Select(),
                Merchants = await _merchantRepository.Select()
            };

            return(View(serviceMerchant));
        }