I have a partial view to edit an object retrieved from the database.
I would like to update that object. How do i get the correct object in that partial view with umbraco?
The surface controller that is taking care of this
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
namespace mysite.WEB.Modules.Locations
{
public class LocationsController : SurfaceController
{
private readonly LocationService _locationService;
public LocationsController()
{
_locationService = new LocationService(new mysite.DATA.CustomDbContext());
}
public ActionResult LandenLijst()
{
ViewModels.LandenLijstViewModel model = new ViewModels.LandenLijstViewModel();
model.Landen = _locationStore.GetLanden();
return PartialView("_LandenLijst", model);
}
public ActionResult EditLand(int id)
{
ViewModels.LandenEditViewModel model = new ViewModels.LandenEditViewModel();
model.Land = _locationStore.GetLanden().FirstOrDefault(x => x.LandId == id);
return PartialView("_LandenEdit", model);
}
[HttpPost]
public ActionResult EditLandPost(ViewModel model)
{
//Saving logic
}
}
}
The problem i am facing is that i cannot seem to get a link to the Edit method passing the id value from the listview.
How can i do this in umbraco, my page viewed in the browser, showing the template of the document type, in his turn calling the partial view and passing the id, or the model or whatever the best practice should be to achieve this.
Any help would be deeply apreciated.
How i am talking to the custom database is not the issue here, i really need the Umbraco/MVC/... way to get all the data to the correct controller.
Update part of a CRUD operation with Umbraco 7.2
I have a partial view to edit an object retrieved from the database. I would like to update that object. How do i get the correct object in that partial view with umbraco?
The Umbraco template is as follows
The surface controller that is taking care of this
The problem i am facing is that i cannot seem to get a link to the Edit method passing the id value from the listview. How can i do this in umbraco, my page viewed in the browser, showing the template of the document type, in his turn calling the partial view and passing the id, or the model or whatever the best practice should be to achieve this.
Any help would be deeply apreciated.
How i am talking to the custom database is not the issue here, i really need the Umbraco/MVC/... way to get all the data to the correct controller.
Thx
is working on a reply...