protected ActionResult RemoveSite(ImportSitesModel model, Trip trip, int siteId) { var site = trip.FindSiteById(siteId); trip.RemoveSite(site); Repositories.Imports.Save(trip); Uow.Persist(); var siteModel = model.FindSiteById(site.Id); model.RemoveSite(siteModel); model.Initialize(); return(Request.IsAjaxRequest() ? PartialView("SitesPartial", model) : (ActionResult)View(model)); }
protected ActionResult AddSite(ImportSitesModel model, Trip trip) { var site = trip.AddSite(); trip.InitializeSites(); Repositories.Imports.Save(trip); Uow.Persist(); Mapper.Map(site, model.AddSite()); model.Initialize(); return(Request.IsAjaxRequest() ? (model.Sites.Count > 2 ? PartialView("SitePartial", model).AddViewData("siteId", site.Id) : PartialView("SitesPartial", model)) : View(model)); }