public async Task <IActionResult> Edit(int id, [Bind("id,ProviderID,ProviderTradingProfileName,CurrencyPairID,DateTimeModified,DateTimeAdded")] ProviderTradingProfile providerTradingProfile) { if (id != providerTradingProfile.id) { return(NotFound()); } if (ModelState.IsValid) { try { providerTradingProfile.DateTimeModified = Utility.GetLocalDateTime(); _context.Update(providerTradingProfile); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProviderTradingProfileExists(providerTradingProfile.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewBag.Provider = new SelectList(_context.Provider.OrderBy(m => m.ProviderName).ToList(), "id", "ProviderName"); ViewBag.CurrencyPair = new SelectList(_context.CurrencyPair.OrderBy(m => m.CurrencyPairName).ToList(), "id", "CurrencyPairName"); return(View(providerTradingProfile)); }
public async Task <IActionResult> Create([Bind("id,ProviderID,ProviderTradingProfileName,CurrencyPairID,DateTimeModified,DateTimeAdded")] ProviderTradingProfile providerTradingProfile) { if (ModelState.IsValid) { providerTradingProfile.DateTimeModified = Utility.GetLocalDateTime(); providerTradingProfile.DateTimeAdded = Utility.GetLocalDateTime(); _context.Add(providerTradingProfile); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewBag.Provider = new SelectList(_context.Provider.OrderBy(m => m.ProviderName).ToList(), "id", "ProviderName"); ViewBag.CurrencyPair = new SelectList(_context.CurrencyPair.OrderBy(m => m.CurrencyPairName).ToList(), "id", "CurrencyPairName"); return(View(providerTradingProfile)); }