Ejemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync(int flagId)
        {
            if (!string.Equals(Action, "delete", StringComparison.OrdinalIgnoreCase))
            {
                return(RedirectToPage("/Index"));
            }

            Employee = await userManager.GetUserAsync(User).ConfigureAwait(false);

            Role = await roleManager.FindByIdAsync(Employee.RoleId.ToString()).ConfigureAwait(false);

            if (!Role.CanAdministerSystem)
            {
                return(RedirectToPage("/Index"));
            }

            var result = await flags.DropFeatureFlag(flagId).ConfigureAwait(false);

            if (result.IsSuccess)
            {
                return(RedirectToPage("/Flags"));
            }
            else
            {
                return(RedirectToPage("/Index"));
            }
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> DeleteFlag(int id)
 {
     return(await flags.DropFeatureFlag(id)
            .OnBoth(f => f.IsSuccess ? StatusCode(200) : StatusCode(500))
            .ConfigureAwait(false));
 }