/// <summary>
        /// this method returns the model needed for d3js projections
        /// </summary>
        /// <param name="projectionDate"></param>
        /// <returns></returns>
        public async Task <List <D3Projection> > getNewModel(DateTime projectionDate)
        {
            int totalMaxCapacity = 0;

            //int totalCurCapacity = 2;

            foreach (var item in await logicHelper.HousingComplexsGetActive())
            {
                totalMaxCapacity += await returnComplexMaxCap(item);

                //totalCurCapacity += await returnComplexCurCap(item);
            }

            List <D3Projection> returnList = new List <D3Projection>();

            for (int i = 0; i < 37; i++)
            {
                D3Projection temp = new D3Projection();
                temp.TotalMax = totalMaxCapacity;
                temp.Date     = projectionDate.ToString("yyyy-MM-dd");
                //temp.CurrentCapacity = totalCurCapacity;
                //totalCurCapacity += 3;
                temp.CurrentCapacity = await findCurrCapDate(projectionDate);

                returnList.Add(temp);
                projectionDate = projectionDate.AddDays(1.0);
            }


            return(returnList);
        }
예제 #2
0
 /// <summary>
 /// CRUD: Read calls logicHelper to get all housingComplexes from service
 /// </summary>
 /// <returns>Task<HttpResponseMessage></returns>
 public async Task <HttpResponseMessage> Get()//[FromUri] bool getActive)
 {
     try
     {
         bool getActive = true;
         if (getActive)
         {
             var Response1 = Request.CreateResponse(HttpStatusCode.OK, await logicHelper.HousingComplexsGetActive());
             log.Info("HousingComplex Get Successful");
             return(Response1);
         }
         var Response2 = Request.CreateResponse(HttpStatusCode.OK, await logicHelper.HousingComplexsGetAll());
         log.Info("HousingComplex Get Successful");
         return(Response2);
     }
     catch (Exception ex)
     {
         LogHelper.SendError(log, ex);
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
 }