public async Task <IActionResult> Edit(int id, [Bind("id,ProviderTradingProfileID,IntroducerID,IntroducerCommissionTypeID,IntroducerCommissionRate,DateTimeModified,DateTimeAdded")] ProviderTradingProfileIntroducerMap providerTradingProfileIntroducerMap)
        {
            if (id != providerTradingProfileIntroducerMap.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    providerTradingProfileIntroducerMap.DateTimeModified = Utility.GetLocalDateTime();
                    _context.Update(providerTradingProfileIntroducerMap);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProviderTradingProfileIntroducerMapExists(providerTradingProfileIntroducerMap.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                ViewBag.ProviderTradingProfile   = new SelectList(_context.ProviderTradingProfile.OrderBy(m => m.ProviderTradingProfileName).ToList(), "id", "ProviderTradingProfileName");
                ViewBag.Introducer               = new SelectList(_context.Introducer.OrderBy(m => m.IntroducerName).ToList(), "id", "IntroducerName");
                ViewBag.IntroducerCommissionType = new SelectList(_context.IntroducerCommissionType.ToList(), "id", "IntroducerCommissionTypeName");

                return(RedirectToAction(nameof(Index)));
            }
            return(View(providerTradingProfileIntroducerMap));
        }
        public async Task <IActionResult> Create([Bind("id,ProviderTradingProfileID,IntroducerID,IntroducerCommissionTypeID,IntroducerCommissionRate,DateTimeModified,DateTimeAdded")] ProviderTradingProfileIntroducerMap providerTradingProfileIntroducerMap)
        {
            if (ModelState.IsValid)
            {
                providerTradingProfileIntroducerMap.DateTimeModified = Utility.GetLocalDateTime();
                providerTradingProfileIntroducerMap.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(providerTradingProfileIntroducerMap);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.ProviderTradingProfile   = new SelectList(_context.ProviderTradingProfile.OrderBy(m => m.ProviderTradingProfileName).ToList(), "id", "ProviderTradingProfileName");
            ViewBag.Introducer               = new SelectList(_context.Introducer.OrderBy(m => m.IntroducerName).ToList(), "id", "IntroducerName");
            ViewBag.IntroducerCommissionType = new SelectList(_context.IntroducerCommissionType.ToList(), "id", "IntroducerCommissionTypeName");

            return(View(providerTradingProfileIntroducerMap));
        }