public async Task <IActionResult> Edit(int id, [Bind("Id,Name_C,ShopeTypeId,Money_C,Date")] Сosts сosts) { if (id != сosts.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(сosts); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!СostsExists(сosts.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ShopeTypeId"] = new SelectList(_context.Shops, "Id", "Id", сosts.ShopeTypeId); return(View(сosts)); }
public async Task <IActionResult> Create([Bind("Id,Name_C,ShopeTypeId,Money_C,Date")] Сosts costs) { if (ModelState.IsValid) { _context.Add(costs); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ShopeTypeId"] = new SelectList(_context.Shops, "Id", "Name", costs.ShopeTypeId); return(View(costs)); }