Ejemplo n.º 1
0
        public async Task <ActionResponse> DeleteRole(int roleId)
        {
            try
            {
                if (roleId == 0)
                {
                    return(new ActionResponse
                    {
                        Message = "Nothing was deleted on id = 0",
                        Status = ActionStatus.Warning
                    });
                }
                await _securityContext.DeleteRole(roleId);

                return(new ActionResponse
                {
                    Status = ActionStatus.Success
                });
            }
            catch (SecurityDbException e)
            {
                return(new ActionResponse
                {
                    Status = ActionStatus.Warning,
                    Message = PrettyExceptionHelper.GetMessage(e)
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new ActionResponse
                {
                    Status = ActionStatus.Error,
                    Message = "Something went wrong!"
                });
            }
        }