Esempio n. 1
0
        public async Task <IActionResult> OilManagementList(int id)
        {
            try
            {
                if (id == 0)
                {
                    throw new ApplicationException("OilManagementList - Id should ne be set to 0");
                }

                var model = new OilManagementViewModel()
                {
                    OilList = await _garageService.GetOilList(id)
                };
                return(PartialView("_oils", model));
            }
            catch (Exception ex)
            {
                ex.ToExceptionless().Submit();
                return(BadRequest());
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> OilManagement()
        {
            try
            {
                var model = new OilManagementViewModel()
                {
                    RootUrl        = BaseRootUrl,
                    OilList        = await _garageService.GetOilList(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());
            }
        }