コード例 #1
0
        public async Task <IActionResult> MaintenanceManagementList(int id)
        {
            try
            {
                if (id == 0)
                {
                    throw new ApplicationException("MaintenanceManagementList - Id should ne be set to 0");
                }

                var model = new MaintenanceManagementViewModel()
                {
                    MaintenanceList = await _optionService.GetMaintenanceList(id)
                };
                return(PartialView("_maintenances", model));
            }
            catch (Exception ex)
            {
                ex.ToExceptionless().Submit();
                return(BadRequest());
            }
        }
コード例 #2
0
        public async Task <IActionResult> MaintenanceManagement()
        {
            try
            {
                var model = new MaintenanceManagementViewModel()
                {
                    RootUrl         = BaseRootUrl,
                    MaintenanceList = await _optionService.GetMaintenanceList(CurrentUser.GarageId),
                    GarageSelector  = new GarageSelectorViewModel
                    {
                        Garages          = await _garageService.GetGaragesSelectList(),
                        SelectedGarageId = HttpContext.User.IsInRole("SuperAdmin") ? 0 : CurrentUser.GarageId,
                        disabled         = HttpContext.User.IsInRole("Administrator")
                    },
                };

                return(View(model));
            }
            catch (Exception ex)
            {
                ex.ToExceptionless().Submit();
                return(BadRequest());
            }
        }