public virtual ActionResult BatchEdit(UpdateListPageModel items) { if (items is null) { throw new ArgumentNullException(nameof(items)); } //This will be used to hold the returned entities while we build our return object List <object> Entities = this.GetEntitiesByGuids(items.Guids.Select(s => Guid.Parse(s)).ToList()); //We're gonna use this to determine the eventual return type of the list Type commonType = Entities.GetCommonType(); DynamicRenderer renderer = new DynamicRenderer(new DynamicRendererSettings(commonType, this.FileProvider) { ExactOnly = true }); BatchEditModelPageModel BEmodel = new BatchEditModelPageModel { Guids = items.Guids, Template = Activator.CreateInstance(commonType) }; MetaObject model = new MetaObject(BEmodel, Constructor); model.Hydrate(); return(this.View(model)); }
/// <summary> /// Accepts a form post of Guids and uses that post to generate an intermediate page for updating a collection of objects /// </summary> /// <returns>The view for the intermediate page containing the update types allowed for object collections</returns> public virtual ActionResult UpdateList() { UpdateListPageModel model = new UpdateListPageModel(); foreach (string key in this.Request.Form.Keys.Where(s => Guid.TryParse(s, out Guid _))) { model.Guids.Add(key); } return(this.View(model)); }