public async Task <IActionResult> Edit(int id, [Bind("CampingFeeId,Name,Amount")] CampingFee campingFee) { if (id != campingFee.CampingFeeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(campingFee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CampingFeeExists(campingFee.CampingFeeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(campingFee)); }
public async Task <IActionResult> Create(string Name, string Amount) { CampingFee campingFee = new CampingFee(); campingFee.Amount = decimal.Parse(Amount, CultureInfo.InvariantCulture); campingFee.Name = Name; if (ModelState.IsValid) { _context.Add(campingFee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(campingFee)); }