public async Task <IdReply> AddAuthorizationNamespace(AuthorizationNamespaceDto authorizationNamespaceDto) { using (var authContext = GetContext()) { var ns = new AuthorizationNamespace { Description = authorizationNamespaceDto.Description, Key = authorizationNamespaceDto.Key }; authContext.AuthorizationNamespaces.Add(ns); authContext.SaveChanges(); return(IdReply.Success(ns.Id)); } }
public async Task <ReplyBase> UpdateAuthorizationNamespace(AuthorizationNamespaceDto authorizationNamespaceDto) { using (var authContext = GetContext()) { var existingNamespace = authContext.AuthorizationNamespaces.Find(authorizationNamespaceDto.Id); if (existingNamespace == null) { return(ReplyBase.NotFound($"Unable to find authorization namespace with id {authorizationNamespaceDto.Id}")); } authContext.SaveChanges(); return(ReplyBase.Success()); } }