public async Task <ActionResult> Edit(int id) { var customer = _dbContext.CustomerOrganisations.Single(c => c.CustomerOrganisationId == id); customer.CustomerSettings = await _dbContext.CustomerSettings.GetCustomerSettingsForCustomer(id).ToListAsync(); if ((await _authorizationService.AuthorizeAsync(User, customer, Policies.Edit)).Succeeded) { return(View(CustomerModel.GetModelFromCustomer(customer))); } return(Forbid()); }
public async Task <ActionResult> View(int id, string message) { var customer = await _dbContext.CustomerOrganisations.GetCustomerById(id); customer.CustomerSettings = await _dbContext.CustomerSettings.GetCustomerSettingsForCustomer(id).ToListAsync(); if ((await _authorizationService.AuthorizeAsync(User, customer, Policies.View)).Succeeded) { return(View(CustomerModel.GetModelFromCustomer(customer, message, (await _authorizationService.AuthorizeAsync(User, customer, Policies.Edit)).Succeeded))); } return(Forbid()); }