using System; using System.Linq; using System.Web.Mvc; using CardNumbers.Models; using CardNumbers.Data; namespace CardNumbers.Controllers { public class ClientController : Controller { private IClientRepository Db; public ClientController() { this.Db = new ClientRepository(new CardNumbersContext()); } public ClientController(IClientRepository Db) { this.Db = Db; }And this is what I currently have in the post version of the Edit method:
[HttpPost] public ActionResult Edit(int id, FormCollection collection) { try { var client = Db.GetClientById(id); client.Address = collection["Address"]; return this.Client(collection); } catch { return View(); } }I don't think this is what I really want for the Edit - I need to somehow update my client and I don't actually want to map each property manually using FormCollection.