public async Task <IActionResult> Edit(int id, [Bind("ClientId,FirstName,SecondName,EmailAddress,PhoneNumber,StreetId,HomeNumber")] CRM_AGD.Areas.Client.Models.Client client) { if (id != client.ClientId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.ClientId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StreetId"] = new SelectList(_context.Streets, "StreetId", "FullName", client.StreetId); return(View(client)); }
public async Task <IActionResult> Create([Bind("ClientId,FirstName,SecondName,EmailAddress,PhoneNumber,StreetId,HomeNumber")] CRM_AGD.Areas.Client.Models.Client client) { if (ModelState.IsValid) { _context.Add(client); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StreetId"] = new SelectList(_context.Streets, "StreetId", "Description", client.StreetId); return(View(client)); }