Hi
What are the advantages of passing a blank object eg Client from the controller?
public ActionResult Create()
{
Client client = new Client();
return View(client);
}
//
// POST: /Client/Create
[HttpPost]
public ActionResult Create(Client clientToAdd)
{
try
{
clientRepository.Insert(clientToAdd);
return RedirectToAction("Index");
As opposed to:
public ActionResult Create()
{
return View();
}
//
// POST: /Client/Create
[HttpPost]
public ActionResult Create(Client clientToAdd)
{
try
{
clientRepository.Insert(clientToAdd);
return RedirectToAction("Index");
The reason being is that: Should an object (eg the Client) be created in an 'unhealthy' state ie blank?
Cheers
Dave