async public Task <ActionResult> ListSummary([FromBody] Core.QueryRequest request) { ActionResult result = BadRequest(); POSMonitorService monitorService = (POSMonitorService)Service.FindService <Model.POSMonitor>(); List <Criteria> criterias = new List <Criteria>(); long page = request.page == null ? -1 : request.page.Value; long size = request.size == null ? -1 : request.size.Value; request?.criterias.ForEach(c => { bool ignoreCriteria = false; if (c.Field.ToLower().Equals("status") && c.Value == "-1") { ignoreCriteria = true; } if (!ignoreCriteria) { criterias.Add(new Criteria() { Field = c.Field, Operator = c.Operator, Value = c.Value }); } }); try { var lista = await monitorService.ListSummary(criterias, page, size); Core.Utilities.ApiResponseBase response = new Core.Utilities.ApiResponseBase() { success = true, data = lista, message = null }; result = Ok(response); } catch (Exception ex) { Core.Utilities.ApiResponseBase response = new Core.Utilities.ApiResponseBase() { success = false, data = null, message = ex.Message }; result = BadRequest(response); } return(result); }
public void CT6_SelectSummary() { POSMonitorService service = (POSMonitorService)_service.FindService <Model.Connector.POSMonitor>(); List <Criteria> criterias = new List <Criteria>(); criterias.Add(new Criteria() { Field = "status", Operator = "eq", Value = "1" }); var lista = service.ListSummary(criterias).Result; Assert.IsNotNull(lista); Assert.IsTrue(lista.Count != 0); lista.ForEach(l => { Console.WriteLine($"id: {l.RecId}, data: {l.TransactionDate}, filial: {l.BranchId}-{l.BranchName}, tickets: {l.CountTickets}, total: {l.SumTickets}"); }); }