diff --git a/projects/IoTCenter/Api/ProductController.cs b/projects/IoTCenter/Api/ProductController.cs index 8c76604b..c8ed9697 100644 --- a/projects/IoTCenter/Api/ProductController.cs +++ b/projects/IoTCenter/Api/ProductController.cs @@ -59,6 +59,22 @@ namespace IoTCenter.Api.Controllers [HttpPost] public ActionResult GetProduct([Required(ErrorMessage = nameof(RequiredAttribute))] string number, string organNumber) { + try + { + var model = this._productRepo.ReadOnlyTable().Where(o => o.Number == number).FirstOrDefault(); + model.Devices = this._deviceRepo.ReadOnlyTable() + .Where(o => o.Product.Id == model.Id) + .WhereIf(!string.IsNullOrWhiteSpace(organNumber), o => o.Node.OrganNodes.Any(o => o.Organ.Number == organNumber)) + .Include(o=>o.Node) + .Include(o=>o.Data) + .ToList(); + return Ok(model); + } + catch (Exception ex) + { + ex.PrintStack(); + return Problem(ex.Message); + } try { var model = this._nodeRepo.ReadOnlyTable() diff --git a/projects/Version.cs b/projects/Version.cs index b5688b78..44228cdf 100644 --- a/projects/Version.cs +++ b/projects/Version.cs @@ -1,4 +1,4 @@ using System.Reflection; [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.20102301")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("1.0.0.20102401")] \ No newline at end of file