public async Task <IActionResult> Edit(int id, [Bind("FirstName,SecondName,LastName,Id,Inn,EntityClientId")] Founder founder) { if (id != founder.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(founder); founder.SetUpdateDate(); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FounderExists(founder.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } //ViewData["EntityClients"] = new SelectList(_context.EntityClients, "Name", "Name", founder.EntityClientId); return(View(founder)); }
public async Task <IActionResult> Create([Bind("FirstName,SecondName,LastName,EntityClientId,Id,Inn")] Founder founder) { if (ModelState.IsValid) { founder.SetCreateDate(); founder.SetUpdateDate(); _context.Add(founder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(founder)); }