public async Task <IActionResult> Edit(int id, [Bind("id,TradeDate,ProviderTradingProfileID,Rate,DateTimeModified,DateTimeAdded")] CostRate costRate) { if (id != costRate.id) { return(NotFound()); } if (ModelState.IsValid) { try { costRate.DateTimeModified = Utility.GetLocalDateTime(); _context.Update(costRate); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CostRateExists(costRate.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewBag.ProviderTradingProfile = new SelectList(_context.ProviderTradingProfile.OrderBy(x => x.ProviderTradingProfileName).ToList(), "id", "ProviderTradingProfileName"); return(View(costRate)); }
// GET: CostRate/Create public IActionResult Create() { ViewBag.ProviderTradingProfile = new SelectList(_context.ProviderTradingProfile.OrderBy(x => x.ProviderTradingProfileName).ToList(), "id", "ProviderTradingProfileName"); CostRate costRate = new CostRate(); costRate.TradeDate = Utility.GetLocalDateTime().Date; return(View("Create", costRate)); }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (Availability == default(decimal) ? 0 : Availability.GetHashCode()); hash = hash * 23 + (CostRate == default(decimal) ? 0 : CostRate.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (Name == null ? 0 : Name.GetHashCode()); return(hash); } }
public async Task <IActionResult> Create([Bind("id,TradeDate,ProviderTradingProfileID,Rate,DateTimeModified,DateTimeAdded")] CostRate costRate) { if (ModelState.IsValid) { costRate.DateTimeModified = Utility.GetLocalDateTime(); costRate.DateTimeAdded = Utility.GetLocalDateTime(); _context.Add(costRate); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewBag.ProviderTradingProfile = new SelectList(_context.ProviderTradingProfile.OrderBy(x => x.ProviderTradingProfileName).ToList(), "id", "ProviderTradingProfileName"); return(View(costRate)); }