Beispiel #1
0
        public bool InitializeAssistanceLevel()
        {
            var context = GetContext();

            context.ActualPage          = enPage.Assistance;
            context.AssistanceUserId    = null;
            context.AssistanceMachineId = null;
            context.CompanyName         = null;
            context.AllPlants           = _mesService.GetAllPlantsMachines();

            context.ActualPeriod = new PeriodModel()
            {
                LastUpdate = new DataUpdateModel()
                {
                    DateTime = DateTime.UtcNow,
                    TimeZone = context.User.TimeZone
                }
            };

            if (context.AllPlants.Any())
            {
                if (context.ActualPlant == null || context.AllPlants.FirstOrDefault(p => p.Id == context.ActualPlant.Id) == null)
                {
                    context.ActualPlant = context.AllPlants.FirstOrDefault();
                }

                context.AllMachines = _machineService.GetAllMachines();

                SetContext(context);
            }

            return(true);
        }
Beispiel #2
0
 public IActionResult GetAllMachines()
 {
     try
     {
         var response = _machineService.GetAllMachines();
         return(Ok(response));
     }
     catch (Exception ex)
     {
         Log.Information($"GetAllMachines Exception {ex.Message} {ex.InnerException.Message}");
         return(BadRequest());
     }
 }
Beispiel #3
0
        public IHttpActionResult GetAllMachines()
        {
            try
            {
                var result = _machineService.GetAllMachines();

                if (result != null && result.Any())
                {
                    return(Ok(result));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
 public IActionResult GetMachines()
 {
     return(View(machineService.GetAllMachines()));
 }
 public IActionResult AddRequest()
 {
     ViewBag.Machines = new SelectList(machineService.GetAllMachines(), "MachineId", "MachineName");
     return(View());
 }