public async Task <IActionResult> Edit(int id, [Bind("ID,PayDate,Amount,Description,CatogoryId")] Payment payment) { if (id != payment.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(payment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentExists(payment.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CatogoryId"] = new SelectList(_context.Categories, "ID", "Name", payment.CatogoryId); return(View(payment)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,IsActive")] Category category) { if (id != category.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
/// <summary> /// Updates the given record. /// </summary> /// <param name="value"></param> /// <returns></returns> public PaymentData Update(PaymentData value) { _context.Update(value); _context.SaveChanges(); return(Get(value.PaymentId)); }