public JsonResult GetAllDataSetItems([FromQuery] GetFromFileModel model) { var container = ContainerFactory.ReadFromFile($"{_dataSetDirectory}/{model.DataSet}"); return(new JsonResult(new { Items = container.AllItems.Select(s => new { s.Id, s.Width, s.Height, s.Value }) })); }
public JsonResult GetFromDataSet([FromQuery] GetFromFileModel model) { var container = ContainerFactory.ReadFromFile($"{_dataSetDirectory}/{model.DataSet}"); var watch = System.Diagnostics.Stopwatch.StartNew(); container.GeneratePowerSet(); container.SortSubsets(); var subset = container.FindBestSubset(); watch.Stop(); long elapsedMs = watch.ElapsedMilliseconds; return(new JsonResult(new { Items = container.AllItems.Select(s => new { s.Id, s.Width, s.Height, s.Value }), ContainerWidth = container.Width, ContainerHeight = container.Height, SelectedSubset = subset.Items.Select(s => new { s.Id, s.Width, s.Height, s.Value, s.UpperLeftCornerPoint, s.DimensionsSwapped }), ExecutionTime = elapsedMs, TotalArea = subset.TotalArea, TotalValue = subset.TotalValue })); }