public IQueryable <MitigationStatusCountView> RetrieveMitigationStatusCount(string Inspector)
 {
     if (String.IsNullOrWhiteSpace(Inspector))
     {
         return(context.Set <MitigationStatus>().OrderBy(x => x.SortOrder).AsQueryable().Select(
                    status => new MitigationStatusCountView
         {
             StatusId = status.Id,
             Status = status.Name,
             StatusCount = _inspectionOrderRepository.Retrieve().Count(
                 io => io.Policy.MitigationStatusId == status.Id
                 )
         }));
     }
     else
     {
         return(context.Set <MitigationStatus>().OrderBy(x => x.SortOrder).AsQueryable().Select(
                    status => new MitigationStatusCountView
         {
             StatusId = status.Id,
             Status = status.Name,
             StatusCount = _inspectionOrderRepository.Retrieve()
                           .Count(io => io.Inspector.UserName == Inspector &&
                                  io.Policy.MitigationStatusId == status.Id)
         }));
     }
 }
示例#2
0
        public IActionResult GetOrders(Guid?id)
        {
            var result = new List <InspectionOrder>();

            if (id == null)
            {
                result.AddRange(_inspectionOrderRepository.Retrieve());
            }
            else
            {
                var order = _inspectionOrderRepository.Retrieve(id.Value);

                result.Add(order);
            }

            return(Ok(result));
        }
        public InspectionOrder Save(Guid id, InspectionOrder inspectionOrder)
        {
            InspectionOrder result  = null;
            var             foundid = _inspectionOrderRepository.Retrieve(id);

            if (foundid == null)
            {
                inspectionOrder.CreatedDate  = DateTime.Now;
                inspectionOrder.AssignedDate = DateTime.Now;
                result = _inspectionOrderRepository.Create(inspectionOrder);
            }
            else
            {
                result = _inspectionOrderRepository.Update(id, inspectionOrder);
            }
            return(result);
        }