views:

73

answers:

1

I'm running into a few problems with CRUD Update (Edit) scenarios where an entity relationship is altered via drop down list of possible entities, using ASP.NET MVC and NHibernate. Probably I am just doing something stupid, so I was wondering if someone could give me a quick example of how this should be done, as I haven't been able to find many examples on the web. (There's nothing like this in NerdDinner for example)

So using an arbitrarily simple model:

Public Class Person
{
   int Id { get; set;}
   string Name { get; set}
   Person Buddy { get; set}
}

Could you give me an example (or link to an example) of the 'Update' Crud view and action(s) in this scenario?

  • Don't worry about repository code
  • For the sake of comparison with some existing code, it would be helpful if the example used formcollection (I know this is not ideal).

Thank you!

+1  A: 

You can try to look at Sharp architecture. They have a Northwind sample with EmployeesController and TransferValues method. There update is shown for nested entities

Sly
Thanks that looks promising - I'll check it out now.
UpTheCreek
Here's the link to the corresponding view code if anyones interested :http://github.com/codai/Sharp-Architecture/blob/master/src/NorthwindSample/app/Northwind.Web/Views/Organization/Employees/EmployeeForm.ascx
UpTheCreek