Exemplo n.º 1
0
        public IActionResult GetSchedule(int clientId)
        {
            string userJWTId = User.FindFirst("id")?.Value;
            Client client    = clientDB.GetCurrentClient(userJWTId);

            if (client == null)
            {
                return(NotFound());
            }

            List <WorkplaceOrder> workplaceOrders = workplaceOrderDB.GetEntityListByClientId(client.Id).ToList();

            List <Scheduler> schedulers = new List <Scheduler>();

            foreach (WorkplaceOrder item in workplaceOrders)
            {
                Workplace workplace = workplaceDB.GetEntity(item.WorkplaceId);
                Building  building  = buildingDB.GetEntity(workplace.BuildingId);
                schedulers.Add(new Scheduler(item.Id.ToString(), item.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                             item.FinishTime.ToString("yyyy-MM-dd HH:mm:ss"), "Назв:" + building.Name + "\nАдр:" + building.Country.ToString() + ","
                                             + building.City.ToString() + "," + building.Street.ToString() + "," + building.House.ToString()
                                             + "," + building.Flat.ToString() + "\nМісце:" + workplace.Id.ToString() + "\nСума:"
                                             + item.SumToPay.ToString(), item.SumToPay.ToString()));
            }
            return(new ObjectResult(schedulers));
        }
Exemplo n.º 2
0
        public IEnumerable <WorkplaceOrder> GetWorkplaceOrdersListByClient(int clientId)
        {
            string userJWTId = User.FindFirst("id")?.Value;
            Client client    = clientDB.GetCurrentClient(userJWTId);

            if (client == null)
            {
                return(null);
            }
            return(WorkplaceOrderDB.GetEntityListByClientId(client.Id));
        }