Example #1
0
        public async Task <ActionResult> Edit(int id)
        {
            var unit = await GetUnitToHandle(id);

            if (unit != null)
            {
                if ((await _authorizationService.AuthorizeAsync(User, unit, Policies.Edit)).Succeeded)
                {
                    return(View(CustomerUnitModel.GetModelFromCustomerUnit(unit, User.IsInRole(Roles.CentralAdministrator))));
                }
            }
            return(Forbid());
        }
Example #2
0
        public async Task <ActionResult> View(int id)
        {
            var unit = await GetUnitToHandle(id);

            if (unit != null)
            {
                if ((await _authorizationService.AuthorizeAsync(User, unit, Policies.View)).Succeeded)
                {
                    return(View(CustomerUnitModel.GetModelFromCustomerUnit(unit)));
                }
            }
            return(Forbid());
        }